CREATE OR REPLACE TRIGGER trg_test before INSERT ON B REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare var_c varchar2(20); BEGIN select c into var_c from A where A.a=:new.b; :new.b:=var_c; end;我怎么感觉你的业务逻辑有问题啊,还是你没表达出意思?
我感觉应该把before 改为after吧
执行时怎么报以下错误:请帮助看看 java.sql.SQLException: ORA-01422: exact fetch returns more than requested number of rows
select c into var_c from A where A.a=:new.b; 这个查询出来的结果不是唯一的。
before
INSERT
ON B
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
declare
var_c varchar2(20);
BEGIN select c into var_c from A where A.a=:new.b;
:new.b:=var_c;
end;我怎么感觉你的业务逻辑有问题啊,还是你没表达出意思?
改为after吧
java.sql.SQLException: ORA-01422: exact fetch returns more than requested number of rows
这个查询出来的结果不是唯一的。