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: Oracle equival to SQL Server @@IDENTITY

Re: Oracle equival to SQL Server @@IDENTITY

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Tue, 30 Sep 2003 14:27:05 -0700
Message-ID: <1064957226.280315@yasure>


Sean Chang wrote:

>I believe you will need 2 statements to accomplish the Insert and select:
>
>Declare
>Next_Num Number(8);
>
>begin
>
>select Your_Sequence.nextval into Next_Num from dual;
>insert into SG_MENUE (LevelName, ErstelltAm, ID#) VALUES ('Neuer bere',
>'10.10.2003',Next_Num);
>------
>end;
>/
>
>then you can return Next_Num as the newest ID# for further use.
>
>Hope this helps.
>
><snipped>
>

Surely you jest. I wrote this before and I will do it again:

insert into SG_MENUE (LevelName, ErstelltAm, ID#) VALUES ('Neuer bere', '10.10.2003',your_sequence.NEXTVAL);

What you suggest accomplishes nothing except to slow down performance.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Tue Sep 30 2003 - 16:27:05 CDT

Original text of this message

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