1

当我运行这个 SQL 时:

CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT
ON FITNESS_BMR
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT t1_seq.nextval INTO :NEW.ID FROM dual;
END;

我收到此错误:

"Error at line 7: PLS-00103: Encountered the symbol ""CREATE""",""

有人知道为什么吗?

4

1 回答 1

0

我在SQL 小提琴中使用了您的代码,但得到了一个稍微不同的错误:

ORA-00900: invalid SQL statement

我将您的代码更改为仅删除分号之后dual,我可以毫无错误地创建。该表也必须存在,但我假设它已经存在!;)

create table FITNESS_BMR ( a number(2) );

CREATE OR REPLACE TRIGGER test_trigger
BEFORE INSERT
ON FITNESS_BMR
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT t1_seq.nextval INTO :NEW.ID FROM dual
END;
于 2013-04-12T02:42:27.253 回答