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

Home -> Community -> Usenet -> c.d.o.server -> Re: MSSQL can,ORACLE can't?? [auto number]

Re: MSSQL can,ORACLE can't?? [auto number]

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 29 Nov 2000 06:55:41 +0100
Message-ID: <9026of$5vh0k$3@ID-62141.news.dfncis.de>

<admire_tw_at_my-deja.com> wrote in message news:901s50$25$1_at_nnrp1.deja.com...
>
>
> there is a simple question about auto increment ID
> we know that
> "insert into table (id,name) values ([seq_name].nextValue,'test')"
> will add(1,'test') to table ,but you still add "[seq_name].nextValue"
> to SQL command .This is differ with mysql or MSSQL.
>
> My Q. is if we create table (id number primary key,name varchar2(20))
> I hope id can create automaticaly,I just command
> "insert into table(name) values('test')" so that
> (1,'test') will add to table.
> This is successful in MSSQL,How about Oralce ??
>
> I am not similar with ORACLE . please help me...Thanks a lot!
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

create a before insert trigger for each row on the affected table(s) selecting <sequence>.nextval into :new.<primarykey column> from dual; No further clues, as evidently you need to get familiar with the Oracle documentation. If you don't have it, it is online at http://technet.oracle.com
Please try to consult it, and/or search deja before coming up with questions like this, which have such an evident answer.

Regards,

Sybrand Bakker, Oracle DBA Received on Tue Nov 28 2000 - 23:55:41 CST

Original text of this message

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