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 |
How to view existing locks on the database?
What is open database communication (odbc) in oracle?
What does sharding mean?
What is ASM (Automatic Storage Management) in Oracle?
What is pragma autonomous transaction in oracle?
Can we call a trigger inside a function and function inside a trigger? Give example.
SELECT THE RECORDS FROM 3 TABLES LIKE(T1,T2,T3) AND HOW CAN WE INSERT THAT RECORD IN ANOTHER TABLE LIKE(T4)?
Which is better Oracle or MS SQL? Why?
Name the three major set of files on disk that compose a database in Oracle?
How do you recover a datafile that has not been physically been backed up since its creation and has been deleted. Provide syntax example.
Why does for update in oracle 8 cause an ora-01002 error?
How do I limit the number of oracle database connections generated by weblogic server?