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
What is the data pump export utility?
What is a data dictionary and how can it be created?
How do I limit the number of rows returned by an oracle query after ordering?
What are the tools for Oracle ?
What is a user role in oracle?
Can we save images in a database and if yes, how?
1) What is ONE_SIZE_FITS_ALL approach? 2) Explain the Common & Variable Header of DATA FILE? 3) What are the Drawbacks to using OMF DB? and the Advantages? 4) List out the Advantages of Undo T.spaces over the Undo SEGMENT? 5) Difference between the Temporary tablespace with TEMPFILE and the Tablespace with TEMPORARY Keyword? 6) What are the situation extents are freeing for reuse.
Explain alias?
What is the sql query to concatenate column values from multiple rows in oracle?
What is difference between cartesian join and cross join?
How to create a table index in oracle?
What is the data pump import utility?
How to loop through data rows in the implicit cursor?
What is oracle database 10g express edition?
How to connect to a remote server?