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: How get SEQUENCE

Re: How get SEQUENCE

From: John Verbil <jverbil_at_netmail.mnet.uswest.com>
Date: 1997/01/17
Message-ID: <32DFE032.6982@netmail.mnet.uswest.com>#1/1

Paolo Dall'Olio wrote:
>
> I'd like some suggestions how to get a SEQUENCE (nextval o currval) ...
>
> sometimes it's usefull to get it before the INSERT or UPDATE statement
> ... at the moment I get it from a one-record table (eg DUMMY) with the
> following:
> SELECT seq_name.NEXTVAL FROM DUMMY;
>
> but I do not like it to much

You're actually pretty close to the "standard" way to do it, which is in fact a select from a one-row table, but most of us use a table called "DUAL" that Oracle supplies specifically for reasons such as this:

SELECT seq_name.NEXTVAL FROM dual;

There's no reason to create a dummy table of your own.

-- 

========================================================================
John Verbil                          | e-mail: jverbil_at_uswest.com
U S WEST Information Technologies    | voice:  (303) 896-0916
Member of the Technical Staff        | fax:    (303) 896-7825
Technical Lead, Forecaster           | 1005 17th Street, Room 1340
                                     | Denver, Colorado  80202
========================================================================
Received on Fri Jan 17 1997 - 00:00:00 CST

Original text of this message

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