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 a Segment ?
In Exception handling if we are using the when others first then what happens . whether it will show the compiler error
Can Multiple instances be run on Single Machine???
how to select second mauximum value in a given table under salary column
What is a tns file?
what are the differen between key flexifild and discriptive fiexifild.
defination of bitmap index
What is meant by joins?
Can we create more than one constraint to column ?
What is difference between UNIQUE constraint and PRIMARY KEY constraint ?
What is the effect of setting the value "CHOOSE" for OPTIMIZER_GOAL, parameter of the ALTER SESSION Command ?
If I have a select statment which retrives 2 rows, & that rows have the same data in all the fields except the last field and I want to merge the 2 rows to be in 1 row with concatenating the last field which have the different data.... eg: the 1st row has these fields: A-B-C the second row has: A-B-X ........ i want to merge the two row to be in one row like ----> A- B- C,X