Re: What sould I do to having auto number??

From: Anders Rasmussen <aura_at_novo.dk>
Date: Thu, 5 Aug 1999 15:54:42 +0200
Message-ID: <DIgq3.346$k5.521_at_news.get2net.dk>


Hi

Assuming you have this table

create table XXX (
id number
blabla1 varchar2
blabla2 varchar2
....
)

create sequence xxx_seq
start with 1
increment by 1
noorder
nocycle
nomaxvalue;

Create or replace trigger seq_xxx
before insert on xxx
for each row
Begin
  Select xxx_seq.nextval
    into :new.id
  from dual;
End;

If you don't want a DB-trigger then make a pre-insert trigger :

  Select xxx_seq.nextval
    into :block1.id
  from dual;

BR

Andy

Kanson Ku wrote in message <37A727F0.E32DF1A4_at_cc.nctu.edu.tw>...
>HI ALL
>What should I do to have auto numbering without typing anything under
>FORM ??
>1. Form trigger
>2. DB trigger
>How to write down the above trigger to get the auto numbering
>
>My Form trigger:
>(PRE-INSERT)
>Select NVL(No,0)+1
>into :Production.Sequence
>From Sequence_number;
>
>--but only with this
>--The Form field don't fill the number automatically
>--How can I write down the DB trigger to achieve the auto numbering???
>
>Thanks in advance
>Kanson Ku
>u8422021_at_cc.nctu.edu.tw
>
>
>
Received on Thu Aug 05 1999 - 15:54:42 CEST

Original text of this message