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 do I find the database name in oracle?
What is Rollback Segment ?
How would you extract DDL of a table without using a GUI tool?
What is the quickest way to export a table to a flat file?
what is query and types of query
How data locks are respected in oracle?
How to increment dates by 1 in oracle?
Maximum how many triggers can be updated in table ?
5 Answers Accenture, Cap Gemini,
How do I use unicode codesets with the weblogic jdriver for oracle driver?
What are the different types of partitions in oracle?
how to retrieve daily sal from emp table in oracle 10g
Difference between inner join vs where ?