2013-02-22 186 views
-3
CREATE OR REPLACE TRIGGER OBU 
BEFORE INSERT ON BOOKING 
REFERENCING NEW AS n 
    FOR EACH ROW 
BEGIN 
INSERT INTO BOOKINGLOG VALUES(n.HOTELID,n.ROOMNO,n.GUESTID,n.STARTDATE,n.ENDDATE,'SYSTEM',SYSDATE); 
ENG; 
. 
/

當我嘗試執行它即時收到此錯誤:Oracle之前INSERT觸發器

LINE/COL ERROR 
-------- ----------------------------------------------------------------- 
3/4  PLS-00103: Encountered the symbol "end-of-file" when expecting 
     one of the following: 
     (begin case declare end exception exit for goto if loop mod 
     null pragma raise return select update while with 
     <an identifier> <a double-quoted delimited-identifier> 
     <a bind variable> << continue close current delete fetch lock 
     insert open rollback savepoint set sql execute commit forall 
     merge pipe purge 
+1

@DCookie - 謝謝你 – LittleBobbyTables 2013-02-22 01:19:59

回答

3

你可能想改變ENG;結束;

並且,失去與/之間的時間間隔。

要提升註釋以回答:INSERT語句中引用表值的值需要以冒號(:)作爲前綴。所以,n.HOTELID應該是:n.HOTELID等

+0

哦,我現在不好即時得到觸發OBU這個錯誤的錯誤: LINE/COL ERROR ------! - ------------------------------------------------ ----------------- 2/1 PL/SQL:SQL語句被忽略 2/74 PL/SQL:ORA-00984:列不允許在這裏 – 2013-02-22 01:27:30

+0

將您的值引用前綴「n」用冒號(:),例如:n.HOTELID – DCookie 2013-02-22 01:30:14

+0

非常感謝:) – 2013-02-22 01:38:24