我使用 oracle 11g express 作为我的数据库在 oracle sql developer 中运行以下语句。我只在尝试创建触发器时遇到问题。我得到消息-
TRIGGER AUTO_NUM_GEN compiled
Warning: execution completed with warning
SQL-
CREATE TABLE myschema.mytable (mynums NUMBER PRIMARY KEY);
CREATE SEQUENCE myschema.seq_of_nums MINVALUE 1
START WITH 1 INCREMENT BY 1 CACHE 10;
CREATE OR REPLACE TRIGGER myschema.auto_num_gen
BEFORE INSERT ON myschema.mytable FOR EACH ROW
BEGIN SELECT seq_of_nums.nextval INTO :new.mynums FROM DUAL; end; /
我的错误是什么,为什么它不起作用?
我运行了诊断查询 -
show errors trigger myschema.auto_num_gen;
并且看到了——
PLS-00103: Encountered the symbol "/" The symbol "/" was ignored
另一方面,当通过 java 运行相同的代码时,我也会得到错误 -
java.sql.SQLSyntaxErrorException: ORA-04098: trigger
'MYTABLE.MYSCHEMA.AUTO_NUM_GEN ' is invalid and failed re-validation