Sequence Number and Triggers

From: ProCard, Inc. <AROBBINS_at_PROCARD.COM>
Date: 1998/03/10
Message-ID: <01bd4c32$0bc668b0$7f5585cc_at_arobbins>#1/1


[Quoted] [Quoted] 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 CET

Original text of this message