Here is my trigger and procedure
both were created successfully on the database via dbaccess.
This trigger is meant to run when a new record is added to the table. All I want it to do it update a separate field on the same table that the trigger is on.
Can this not be done?
CREATE PROCEDURE buff_licno1 (pakey integer)
DEFINE nexno integer;
DEFINE lkey INTEGER;
define testkey integer;
set debug file to "/scratch/trig.trace";
TRACE "begin trace";
TRACE ON;
LET nexno = (SELECT nextvalu from buff_seq1);
LET testkey = (SELECT Max(cobcoo.apkey) AS MaxOfapkey FROM cobcoo);
UPDATE cobcoo SET trcerti = nexno where apkey = testkey;
update buff_seq1 set nextvalu = nextvalu +1;
TRACE OFF;
END PROCEDURE;
CREATE TRIGGER licno_trig1
INSERT ON cobcoo
REFERENCING NEW AS new_licno1
FOR EACH ROW (EXECUTE PROCEDURE buff_licno1(new_licno1.apkey));
both were created successfully on the database via dbaccess.
This trigger is meant to run when a new record is added to the table. All I want it to do it update a separate field on the same table that the trigger is on.
Can this not be done?
CREATE PROCEDURE buff_licno1 (pakey integer)
DEFINE nexno integer;
DEFINE lkey INTEGER;
define testkey integer;
set debug file to "/scratch/trig.trace";
TRACE "begin trace";
TRACE ON;
LET nexno = (SELECT nextvalu from buff_seq1);
LET testkey = (SELECT Max(cobcoo.apkey) AS MaxOfapkey FROM cobcoo);
UPDATE cobcoo SET trcerti = nexno where apkey = testkey;
update buff_seq1 set nextvalu = nextvalu +1;
TRACE OFF;
END PROCEDURE;
CREATE TRIGGER licno_trig1
INSERT ON cobcoo
REFERENCING NEW AS new_licno1
FOR EACH ROW (EXECUTE PROCEDURE buff_licno1(new_licno1.apkey));