Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger: Simulating AutoCounter of MSAccess (Newbie)

Re: Trigger: Simulating AutoCounter of MSAccess (Newbie)

From: Heinz Kiosk <no.spam_at_ntlworld.com>
Date: Wed, 20 Feb 2002 13:37:36 -0000
Message-ID: <1HNc8.119963$H37.15651719@news2-win.server.ntlworld.com>


Stefan/Ich,

If you want to duplicate more of the attributes of an autonumber you should qualify the
for each row :

for each row when (new.betreuernr = 0 or new.betreuernr is null)

That way whenever you supply your own value (typically when loading data) it will be used rather than the sequence. So you can create your sequence and trigger at the same time as the rest of the database, rather than waiting till after initial data upload.

Regards

"Stefan Donath" <harald.gogger_at_de.bosch.com> wrote in message news:a4vr37$9e1$1_at_ns1.fe.internet.bosch.com...
>
> Well, I got it!
>
> The following trigger does it will:
>
> CREATE or replace TRIGGER PMST27.T_Betreuer_AW_Trig before insert on
> PMST27.T_Betreuer for each row
> begin
> Select T_Betreuer_seq.nextval into :new.betreuernr From DUAL;
> end;
>
>
>
Received on Wed Feb 20 2002 - 07:37:36 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US