我创建了上面的触发器,但它给了我错误: PLS-00103:当遇到以下情况之一时遇到符号“文件结束”:符号“;”被替换为“文件结束”继续
触发码:
CREATE OR REPLACE TRIGGER
subView_insert_tr INSTEAD OF INSERT ON VSubscriber
DECLARE
lendings Lending_tab ;
i INTEGER ;
copy_book_var Copy_list_T;
copy_book_vartemp REF Copy_list_T ;
BEGIN
lendings := :NEW.Lending_List;
INSERT INTO Subscriber (num_s, name) VALUES (:NEW.num_s, :NEW.name) ;
FOR i IN 1..lendings.COUNT LOOP
copy_book_vartemp := lendings(i).Copy_Book_REF;
SELECT DEREF(copy_book_vartemp) INTO copy_book_var FROM DUAL ;
INSERT INTO LENDING (num_s, num_c) VALUES (
:NEW.num_s, copy_book_var.num_c,
lendings(i).d_L) ;
END LOOP ;
END ;
/
答案 0 :(得分:0)
我认为问题在于此插入
INSERT INTO LENDING (num_s, num_c) VALUES (
:NEW.num_s, copy_book_var.num_c,lendings(i).d_L) ;
修改了它,并尝试使用此
CREATE OR REPLACE TRIGGER
subView_insert_tr INSTEAD OF INSERT ON VSubscriber
DECLARE
lendings Lending_tab ;
i INTEGER ;
copy_book_var Copy_list_T;
copy_book_vartemp REF Copy_list_T ;
BEGIN
lendings := :NEW.Lending_List;
INSERT INTO Subscriber (num_s, name) VALUES (:NEW.num_s, :NEW.name) ;
FOR i IN 1..lendings.COUNT LOOP
copy_book_vartemp := lendings(i).Copy_Book_REF;
SELECT DEREF(copy_book_vartemp) INTO copy_book_var FROM DUAL ;
INSERT INTO LENDING (num_s, num_c) VALUES (
:NEW.num_s, copy_book_var.num_c);
-- lendings(i).d_L) ;
END LOOP ;
END ;
/