当我尝试编译以下Oracle代码时:
CREATE TABLE authors (
id NUMBER PRIMARY KEY, /* what if two authors have the same name! */
name VARCHAR2(200) NOT NULL
);
/* autoinrement sequence */
CREATE SEQUENCE authors_id_seq START WITH 1 INCREMENT BY 1;
/* trigger run before every insert into authors table - copies MySQL autoincrement */
CREATE TRIGGER authors_insert_trg BEFORE INSERT ON authors
FOR EACH ROW WHEN (new.id IS NULL)
BEGIN
SELECT authors_id_seq.nextval INTO :new.id FROM FUAL;
END;
它说:
table AUTHORS created.
sequence AUTHORS_ID_SEQ created.
TRIGGER authors_insert_trg compiled
Warning: execution completed with warning
我看不到任何错误。有人可以帮帮我吗?
答案 0 :(得分:3)
错字:FROM FUAL
应为FROM DUAL