Can we call a trigger inside a function and function inside a
trigger? Give example.

Answer Posted / manikandan. s

triggers can't be called. They will be fired automatically
during certain operations like insert, delete, etc..

Inside a trigger we can call function

Ex

CREATE OR REPLACE FUNCTION f_t RETURN NUMBER IS
tmpVar NUMBER;
BEGIN
select sum(col2) into tmpVar from t;
RETURN tmpVar;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
RAISE;
END f_t;
/

CREATE OR REPLACE TRIGGER L4OC.T_T
AFTER INSERT
ON L4OC.T
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
declare
tmpvar number;
begin
select f_t into tmpvar from dual;
insert into t_t values(:old.col1, tmpvar);
end;
/

Is This Answer Correct ?    9 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an oracle wallet?

515


What is oracle instant client?

566


How would you best determine why your MVIEW couldnt FAST REFRESH?

1438


What is difference between sid and service name in oracle?

519


Explain mutating triggers.

575






Is insert autocommit in oracle?

605


Does oracle database need java?

522


What is an Oracle index?

1178


State and explain about oracle instance?

551


How to define default values for formal parameters?

597


normally database take to refresh time 2 hours. but client asked iwant to refresh with in 5 min that same database. do you have any option in BO and Oracle? explain me briefly...kavi

1743


What is the implicit cursor in oracle?

570


How to assign values to variables?

580


How do I decide when to use right joins/left joins or inner joins or how to determine which table is on which side?

546


How to use subqueries in the from clause in oracle?

579