Re: How to so select on sequence ?

From: Mark Styles <lambic_at_msn.com>
Date: 1996/09/19
Message-ID: <51r6cd$7hc_at_pheidippides.axion.bt.co.uk>#1/1


shinu_at_openix.com (Shinu Gupta) wrote:
>I want to do a select on the sequence,
>
>select nextVal from seq
>
>fails.

A few people have replied saying do 'select seq.nextval from dual', I just thought it should be clarified that you don't have to use dual, you can select seq.nextval from any table, so if you are already doing a select, say on an employees table, you can incorporate the nextval into the one select, something like:

select seq.nextval   nval
      ,emp.emp_name  ename
      ,emp.salary    esal

from emp
where emp_no = 234;

Also remember that you can't use currval until you have used nextval in the current session. Received on Thu Sep 19 1996 - 00:00:00 CEST

Original text of this message