Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Can we call a trigger inside a function and function inside a
trigger? Give example.



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

Post New Answer

More Oracle General Interview Questions

When do we use group by clause in a sql query?

0 Answers  


How to rebuild an index in oracle?

0 Answers  


How to assign query results to variables?

0 Answers  


what is the exact diiference between DBMS and RDBMS

4 Answers   Tesco,


What is Java Pool in Oracle?

0 Answers   MCN Solutions,






How to get a list of all tables in the database?

1 Answers  


What a SELECT FOR UPDATE cursor represent.?

1 Answers  


In which dictionary table or view would you look to determine at which time a snapshot or MVIEW last successfully refreshed?

1 Answers  


What do you understand by database schema and what does it hold?

0 Answers  


5. Display full details from the ORDER_LINE table where the item number is (first condition) between 1 and 200 (no > or < operators) OR the item number is greater than 1000 AND (second condition) the item cost is not in the list 1000, 2000, 3000 OR the order number is not equal to 1000.

3 Answers   Wipro,


Explain parameter file in oracle.

0 Answers  


What is an Index Segment ?

2 Answers  






Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (509)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)