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

How do I find the database name in oracle?

0 Answers  


What is Rollback Segment ?

3 Answers  


How would you extract DDL of a table without using a GUI tool?

1 Answers  


What is the quickest way to export a table to a flat file?

0 Answers  


what is query and types of query

6 Answers   Reliance,






How data locks are respected in oracle?

0 Answers  


How to increment dates by 1 in oracle?

0 Answers  


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?

0 Answers  


What are the different types of partitions in oracle?

0 Answers  


how to retrieve daily sal from emp table in oracle 10g

2 Answers   Infosys,


Difference between inner join vs where ?

0 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 (510)
  • 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)