开发者

How to call PL/SQL function in side a trigger

I am new to pl/sql. can any one tell me how to call pl/sql function inside a trigger.

I tired it but it gives an error when i try to run it.

DROP TRIGGER INTF_CONTROLLER_TREXE;

CREATE OR REPLACE TRIGGER INTF_CONTROLLER_TREXE
before insert ON INTF_CONTROLLER for each row
begin
BACKOFFICE_UPDATE();
end;


CREATE OR REPLACE FUNCTION BACKOFFICE_UPDATE
RETURN NUMBER IS
tmpVar NUMBER;

BEGIN
   tmpVar := 0;
   DBMS_OUTPUT.put_line ('HELLO');
   RETURN tmpVar;


   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       NULL;
     WHEN OTHERS THEN
       -- Consider logging the error and then re-raise
       RAISE;
END BACKOFF开发者_Python百科ICE_UPDATE;

I tried to run it using TOAD. it gives the following error

PLS-00221: 'BACKOFFICE_UPDATE' is not a procedure or is undefined


You need to store the result of your function call in a local variable

For example:
CREATE OR REPLACE TRIGGER INTF_CONTROLLER_TREXE 
before insert ON INTF_CONTROLLER for each row 
declare
dummy NUMBER;
begin 
dummy := BACKOFFICE_UPDATE(); 
end; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜