下面提到在oracle sql plus中正确执行的sql Trigger
CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT ON RESULTS
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT Pd_seq.nextval INTO :NEW.PT_ID FROM dual;
END;
/
但是同样的代码,通过java实现时,抛出如下错误
代码:
ResultSet rs1 = stmt.executeQuery("CREATE OR REPLACE TRIGGER test_trigger123 "+
"BEFORE INSERT ON RESULTS"+
"REFERENCING NEW AS NEW"+
"FOR EACH ROW"+
"BEGIN"+
"SELECT Pd_seq.nextval INTO :NEW.PT_ID FROM dual;"+
"END;"+
"\n/");
Eclipse 中的错误消息:
SQL Exception:
State : 42000
Message: ORA-04079: invalid trigger specification
Error : 4079
请协助。是什么导致了错误?