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 |
What is SGA ? How it is different from Ver 6.0 and Ver 7.0 ?
which language is used to develop the oracle........?
How to start an oracle instance?
How do you get nicely formatted results from an oracle procedure that returns a reference cursor?
Which Department has MOST NUMBER of employees?
8 Answers IBM, LeadSquared, Mastek,
What is a view and how is it different from a table?
how to select alphabets in a one column , for this the table name is PA_TASKS and column name is TASK_NUMBER, In TASK_NUMBER the data like this 1.1.3NN,1.1.4NN,1.5.1NN,1.3.2NE,1.5NN,1NN,1.2NE,1CE , For this i need to disply output as only NN,but not other alphabets, if NN is thre means i should display , otherwise leave that blank or empty Its some urgent requirement ,thanks in advance
What are the differences between a sys and system user and what are the extra privileges available to the sys user?
What is trigger associated with the timer ?
Is primary key = unique key,not null? If yes,please explain IF No,please explain
How to rename an existing table?
find out the third highest salary?
92 Answers CIPL, Cyber Shot, HCL, Hewitt, IBM, JPMorgan Chase, Orion, Verizon,