Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Sqlplus Question

Re: Sqlplus Question

From: <mpir_at_compuserve.com>
Date: Wed, 17 Jun 1998 13:49:18 GMT
Message-ID: <6m8hgu$9do$1@nnrp1.dejanews.com>


an alternative would be something like the following in a script

col nowval new_value thenval
select sequence.nextval nowval from dual;

The field thenval now has the current value of the sequence store in as a memory value that can be subsequently accessed by other sql statements in the same session (unless cleared.)

In article <6m6gch$1ij$4_at_trotsky.cig.mot.com>,   weiss_at_cig.mot.com (Phill Weiss) wrote:
>
> In article <lorenzen-ya02408000R1606981331550001_at_news.visi.com>,
lorenzen_at_tiny.net (James Lorenzen) writes:
> > In article <6m68ld$1ij$3_at_trotsky.cig.mot.com>, weiss_at_cig.mot.com (Phill
> > Weiss) wrote:
> >
> > >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.
> >
> > Phill;
> > Use "currval" from the sequnce. This will return the current value of the
> > sequence afer "nextval" is used in the session.
> >
> > HTH
> > James
> > --
> > lorenzen_at_tiny.net | Life is complex; it has
> > | real and imaginary parts
>
> I already thought of using currval but, what if someone else uses nextval
> just before I run my query? This is why nextval has to be stored in a
variable.
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Wed Jun 17 1998 - 08:49:18 CDT

Original text of this message

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