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 |
How do you recover a datafile that has not been physically been backed up since its creation and has been deleted. Provide syntax example.
How can I introduce multiple conditions in like operator?
How to rename a tablespace in oracle?
What are the uses of linked server and explain it in detail?
What is save point in oracle database?
What are the extensions used by oracle reports?
Can you tell me how to add new column in existing views?how?How is possible?
What is a View ?
How to define an anonymous procedure with variables?
16. Display the order number, order line number and the shipping date. If the shipping date is null, display the string <not shipped yet>.
Why does for update in oracle 8 cause an ora-01002 error?
hi friends, I have a table A col as status|NUM and value as open |1 open |2 close |3 close |3 the O/P should be open|close 1 |3 2 |4