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: Sqlplus Question

Re: Sqlplus Question

From: Matt Brennan <mbrennan_at_gers.antispam.com>
Date: Tue, 16 Jun 1998 20:23:31 GMT
Message-ID: <01bd9964$9d0e95c0$049a0580@mcb>


Yes. Define your variable as the sequence's next value and then do your query (shown here in a .sql file):

define myvar = "myseq.nextval"
select &myvar from dual
/

This should give results like this when run:

SQL> @myscript.sql
SQL> define myvar = "MYSEQ.nextval"
SQL> select &myvar from dual

  2 /
old 1: select &myvar from dual
new 1: select MYSEQ.nextval from dual

NEXTVAL


   1257

SQL> /
old 1: select &myvar from dual
new 1: select MYSEQ.nextval from dual

NEXTVAL


   1258

Etc....
--
Matt Brennan
SQL*Tools Specialist
GERS Retail Systems
9725-C Scranton Road
San Diego, California 92121
1-800-854-2263
mbrennan_at_gers.com
(Original email address is spam-blocked.)

Phill Weiss <weiss_at_cig.mot.com> wrote in article <6m68j2$1ij$2_at_trotsky.cig.mot.com>...
> Is it possible to make a sqlplus query for the nextval of a sequence in
one
> query, store the result in a variable, and use the variable in a
subsequent
> sqlplus query? I don't want to have to use pl/sql to do this, only
sqlplus.
> If this is possible, please enlighten me as to how I can go about it.
Thanks. Received on Tue Jun 16 1998 - 15:23:31 CDT

Original text of this message

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