我有了这个触发器,似乎没问题,但我得到了错误:
触发器:
CREATE OR REPLACE TRIGGER TRG_TABLE_BI
BEFORE INSERT
ON TABLE
FOR EACH ROW
DECLARE
CURSOR cur_list IS
SELECT emp, name, day, salary, id,phone
FROM TABLE NATURAL JOIN OTHERTABLE
WHERE emp = :NEW.emp AND name = :NEW.name AND id = :NEW.id;
curChoice cur_list%ROWTYPE;
BEGIN
OPEN cur_list;
LOOP
FETCH cur_list INTO curChoice;
EXIT WHEN cur_list%NOTFOUND;
dbms_output.put_line(curchoice.id);
dbms_output.put_line(curChoice.emp);
dbms_output.put_line(curchoice.name);
END LOOP;
CLOSE cur_list;
END;
/
我收到了这些错误:
PLS-00049: bad bind variable 'NEW.emp'
如果我在WHERE子句中删除游标声明中的':',我会收到更多错误
谢谢。
答案 0 :(得分:0)
好的,我发现错误,在WHERE子句的游标声明中,我不得不删除
emp = :NEW.emp AND name = :NEW.name
因为我正在插入的表格中没有这样的列。
谢谢!