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 the indexes are stored in the Oracle Database?
What is the scope of a local variable?
Please explain compound trigger in oracle?
How to rename an index?
Maximum how many triggers can be updated in table ?
5 Answers Accenture, Cap Gemini,
What happens to the current transaction if the session is ended?
WHT ARE THE AGGREATE FUNCTIONS?
How to resolve name conflicts between variables and columns?
How would you begin to troubleshoot an ORA-3113 error?
How to create a table interactively?
What is the recommended interval at which to run statspack snapshots, and why?
In Oracle 9i what does "i" Stands for?