create or replace TRIGGER SET_HOLDER_IN_ONLINE_DOC
BEFORE INSERT ON tasks
FOR EACH ROW
DECLARE
id, repl_id NUMBER;
BEGIN
IF :new.holder_role_id = 10 THEN
SELECT user_id, repl_user_id INTO id, repl_id FROM roles
WHERE roles.id=10;
IF repl_id = 0 THEN
:new.holder_user_id := id;
ELSE
WHILE repl_id > 0
LOOP
SELECT user_id, repl_user_id INTO id, repl_id FROM roles
WHERE user_id=repl_id;
END LOOP;
:new.holder_user_id := id;
END IF;
END IF;
END;
答案 0 :(得分:2)
您不能像在其他语言中一样声明两个变量,所以:
DECLARE
id, repl_id NUMBER;
BEGIN
应该是:
DECLARE
id NUMBER:
repl_id NUMBER;
BEGIN