How I have to do to define and use a cursor?
I need to modify a value in a table, but this is inside the trigger. So I get a mutant table.
I think that creating a temporary table and using a cursor for fetching its values I can solve the problem.
CREATE TRIGGER td_eq before delete ON eq FOR EACH ROW
INSERT INTO tmp_eq VALUES ( : old.NroEq, : old.Anio)
CREATE TRIGGER td_eq1 before delete ON eq
DECLARE Y NUMBER;
CURSOR C IS SELECT NroEq FROM eq
FETCH C INTO Y,
WHILE C%found LOOP
SELECT Act INTO Act FROM eq WHERE NroEq = Y;
IF Act = 1 THEN
/*to do something*/
FETCH C INTO Y
DELETE FROM tmp_eq;
Besides, I have another problem:
In the body of a trigger o stored procedure I write the following statement
set Act = 0
where Table_P.N= X;
But the previous code do not update that attribute (Act) in Table_P