Can we call a trigger inside a function and function inside a
trigger? Give example.
Answer / 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 |
What is the recommended interval at which to run statspack snapshots, and why?
How to experiment a data lock in oracle?
How to create a new user account in oracle?
Which are the five query types available in oracle?
What are the logical operations?
In which language oracle has been developed?
How to import one table back from a dump file?
How would you configure your networking files to connect to a database by the name of DSS which resides in domain icallinc.com?
What are synonyms used for ?
write a query to dispaly those name who is more than one in student table? example- in a student table sandeep kumar comes 4 times, rakesh kumar comes 2 times, ajit kumar comes 1 times so query will display sandeep kumar and rakesh kumar single times.
What do you mean by merge in oracle and how can we merge two tables?
What is a deadlock ? Explain .