Re: How to so select on sequence ?

From: Ken Mizuta <kmizuta_at_jp.oracle.com>
Date: 1996/09/18
Message-ID: <3240839A.785C_at_jp.oracle.com>#1/1


Shinu Gupta wrote:
>
> Hi:
>
> I am rather new to Oracle. I am currently using sequences for generating unique
> numbers. I am able to use seq.nextval and seq.currval successfully in insert
> and update statements.
>
> I want to do a select on the sequence, increment the value and save the value
> in a variable. The book says that I can do select on a sequence - but i can't
> figure out how.
>
> select nextVal from seq
>
> fails.
>
> Shinu Gupta

Look in your manual about the dual table.

select seq.nextval from dual;

or in PL/SQL

select seq.nextval into somevar from dual;

-- 
                   ____________________________________________ 
                  /    Kenichi Mizuta 
                 /     Oracle Corporation (Redwood Shores, CA) 
      ////      /      Applications Division 
     |0 0|     /       email: kmizuta_at_us.oracle.com 
_ooO_ \U/_Ooo_/        url: http://www.tripod.com/~kmizuta/

The comments and opinions expressed herein are mine and
do not necessarily represent those of Oracle Corporation.
Received on Wed Sep 18 1996 - 00:00:00 CEST

Original text of this message