ORA-01403: 未从 INSERT 触发器中找到数据
ORA-01403: no data found from INSERT trigger
我正在尝试使用 oracle 11g 第 2 版配置数据库,我在其中创建了一个 table 名为 UTILITY:
create table utility
(
u_id varchar2(12),
name varchar2(20)NOT NULL,
status varchar2(10),
paid_amount number(7,2)NOT NULL,
month varchar2 (2) NOT NULL,
year varchar2 (4) NOT NULL,
company varchar2(20)NOT NULL,
constraint u_id_pk primary key(u_id)
);
我也创建了一个序列
CREATE SEQUENCE "ASMADB"."UTILITY_ID_SEQ" MINVALUE 1 MAXVALUE 9999999999
INCREMENT BY 1 START WITH 1 CACHE 10 NOORDER NOCYCLE ;
和 table 的触发器:
create or replace trigger uility_id
before insert on utility
for each row
begin
select to_char('U')||'-'||lpad(utility_id_seq.nextval,9,'0')
into :new.u_id
from utility;
end;
但每当我尝试在实用程序中插入值时,都会发生以下错误:
Error starting at line : 1 in command
insert into utility values (' ','Electricity Bill','due',5340.59,to_char(to_date('12/06/2020','dd/mm/yyyy'),'mm'),to_char(to_date('12/06/2020','dd/mm/yyyy'),'yyyy'),'Rakib Electricity')
Error report
ORA-01403: no data found
ORA-06512: at "ASMADB.UILITY_ID", line 2
ORA-04088: error during execution of trigger 'ASMADB.UILITY_ID'
如果有人帮我解决这个错误,那将非常有帮助。
- 注意:table 实用程序是空的。
不是那样;简直
create or replace trigger uility_id
before insert on utility
for each row
begin
:new.u_id := 'U-' || lpad(utility_id_seq.nextval,9,'0');
end;
我正在尝试使用 oracle 11g 第 2 版配置数据库,我在其中创建了一个 table 名为 UTILITY:
create table utility
(
u_id varchar2(12),
name varchar2(20)NOT NULL,
status varchar2(10),
paid_amount number(7,2)NOT NULL,
month varchar2 (2) NOT NULL,
year varchar2 (4) NOT NULL,
company varchar2(20)NOT NULL,
constraint u_id_pk primary key(u_id)
);
我也创建了一个序列
CREATE SEQUENCE "ASMADB"."UTILITY_ID_SEQ" MINVALUE 1 MAXVALUE 9999999999
INCREMENT BY 1 START WITH 1 CACHE 10 NOORDER NOCYCLE ;
和 table 的触发器:
create or replace trigger uility_id
before insert on utility
for each row
begin
select to_char('U')||'-'||lpad(utility_id_seq.nextval,9,'0')
into :new.u_id
from utility;
end;
但每当我尝试在实用程序中插入值时,都会发生以下错误:
Error starting at line : 1 in command
insert into utility values (' ','Electricity Bill','due',5340.59,to_char(to_date('12/06/2020','dd/mm/yyyy'),'mm'),to_char(to_date('12/06/2020','dd/mm/yyyy'),'yyyy'),'Rakib Electricity')
Error report
ORA-01403: no data found
ORA-06512: at "ASMADB.UILITY_ID", line 2
ORA-04088: error during execution of trigger 'ASMADB.UILITY_ID'
如果有人帮我解决这个错误,那将非常有帮助。
- 注意:table 实用程序是空的。
不是那样;简直
create or replace trigger uility_id
before insert on utility
for each row
begin
:new.u_id := 'U-' || lpad(utility_id_seq.nextval,9,'0');
end;