| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sqlplus Question
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
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
![]() |
![]() |