Re: Help ! Storing value in temp variable in sqlplus

From: Randy Dewoolfson <randyd_at_cais3.cais.com>
Date: 1995/07/09
Message-ID: <3tp7h7$k55_at_news.cais.com>#1/1


Patrick McCarthy (pmccarth_at_rpc.unb.ca) wrote:

: Qualifier :> I am a novice user.
 

: I need to create a sql script file which will pull the max(value) of a field
: and store it into a temporary variable (temp_var). I then must add 1 to the
: temp value (temp_var + 1) and then insert the value into a table (insert into
: table values (temp_var, null, null.......)
 

: I am just not sure how to create this temp variable, give it a value and then
: reference the variable in a later insertion function call.
 

: Any help would be greatly appreciated.
 

: Thanks in advance.
 

: Patrick McCarthy
: Systems Developer
: RPC
: email -> pmccarth_at_rpc.unb.ca

It sounds like what you REALLY want is a counting SEQUENCE. Look this up in the manual, CREATE SEQUENCE then SELECT the NEXTVAL from it...

Good luck
Randy

--
    ..uu.                                     ----------------------
  .?$" '?i     .                              I  Randy DeWoolfson  I
 .T^M  ._at_"    d9    .     f   ,.un.  b,    i  I--------------------I
 "  Z :#"    M `8   U    <  .dP"``"# `M   _at_"  I  randyd_at_cais.com   I
    &H?`    Xl _R   $5.  $  ?*    _at_   'P,#"   I--------------------I
  ,d#^*L   :RP'~$b  f`$L:M  Xf  .f'    dH`    I        ,\//.       I
    &  'M ,P    `E  M   "$  Mux~      n!`     I        |o o|       I
   dk   `h"       ' j     " y"       *~       I====oOO==(_)==Ooo===I
Received on Sun Jul 09 1995 - 00:00:00 CEST

Original text of this message