Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Seqence Number in Triggers Please Help
Every time a record is inserted into a table I would like the trigger to update the PK before insert with a sequence number. We are unable to alter our current insert statements to complete the operation. The inserts are also used on Ms Sql Server and Ms Access. Below I have listed some examples that do not work yet. Please help.
Andy Robbins
ProCard Inc
arobbins_at_procard.com
CREATE OR REPLACE TRIGGER TR_ANDY_TEST
BEFORE INSERT ON TB_ANDY_TEST
FOR EACH ROW
BEGIN
:NEW.DT= DT_SEQ.NEXTVAL
END;
/
CREATE OR REPLACE TRIGGER TR_ANDY_TEST
BEFORE INSERT ON TB_ANDY_TEST
FOR EACH ROW
DECLARE newrow number;
BEGIN
newrow = DT_SEQ.NEXTVAL
END;/
Received on Tue Mar 10 1998 - 00:00:00 CST