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
How to invoke the data pump import utility?
i wrote a pl/sql procedure. it must run every sunday 4.40 How can i schedule it with the help of dbms_jobs (or another other procedure with out creating bat file,exe file)
What is tns service name?
What are the different windows events activated at runtime ?
hello friends Im doing my final year engineering in B.Tech.. one of uncle said he can provide job in his company if im good in database management. but i have only basic knowledge about database, so like to join database management course in good intuition. so friends kindly help me to get good intuition because its my future.
State any two functions of oracle?
How do you bind variables in oracle?
What is a schema in oracle?
Is it possible to set second Primary Key Constraint in a table in Oracle Database ?
Is it possible to insert comments into sql statements return in the data model editor ?
List the parts of a database trigger.
Explain the difference between a procedure and a function?
WHAT IS ecc 6.0
What is pragma autonomous transaction in oracle?
WHEN CURSOR MOVES FROM ONE FORM TO ANOTHER FORM, HOW MANY TRIGGER WILL BE FIRED AND WHAT ARE THEIR SEQUENCE?