2013-09-23 124 views
0

我想在Toad中觸發我的表時觸發錯誤。嘗試在表ORACLE中創建觸發器時出錯

這樣的代碼:

create table SEIAPPS_MODEL(MODEL_NO NUMBER PRIMARY KEY, MODEL_NAME VARCHAR(100)) 

create sequence SEIAPPS_MODEL_SEQ 
start with 1 
increment by 1 

CREATE OR REPLACE TRIGGER TR_SEIAPPS_MODEL 
BEFORE INSERT 
ON SEIAPPS_MODEL 
REFERENCING NEW AS NEW 
FOR EACH ROW 
BEGIN 
SELECT SEIAPPS_MODEL_SEQ.nextval INTO :NEW.MODEL_NO FROM dual; 
END; 

我得到的錯誤是: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ;

我缺少什麼?

+0

任何意見傢伙? –

+1

也許是一個克里特表後和cerate序列表後的';'。並且在創建觸發器陳述 – schurik

+0

後可以給我一個例子嗎? –

回答

1
create table SEIAPPS_MODEL(MODEL_NO NUMBER PRIMARY KEY, MODEL_NAME VARCHAR(100)) ; 
--                     ^^^^ 
    create sequence SEIAPPS_MODEL_SEQ 
    start with 1 
    increment by 1 
    ; 
-- ^^^^ 

    CREATE OR REPLACE TRIGGER TR_SEIAPPS_MODEL 
    BEFORE INSERT 
    ON SEIAPPS_MODEL 
    REFERENCING NEW AS NEW 
    FOR EACH ROW 
    BEGIN 
    SELECT SEIAPPS_MODEL_SEQ.nextval INTO :NEW.MODEL_NO FROM dual; 
    END; 
    /
-- ^^^^ 
+0

我試過了,但仍然像以前一樣 –

0

您的查詢沒有語法錯誤。我不知道爲什麼你會得到這個錯誤。

我執行了一個一個的陳述,我能夠執行所有三個成功......