Re: Help ! Storing value in temp variable in sqlplus

From: Rennick Sandra <t89003_at_isdserv.dehavilland.ca>
Date: 1995/07/06
Message-ID: <1995Jul6.201906.19360_at_dhnews.dehavilland.ca>#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

Try doing something like this:

column max_val new_value temp_var noprint

select max(value) max_val
from tablename;

insert into table values (&&temp_var+1, null, null .....);

Hope this helps.

Sandra Rennick Received on Thu Jul 06 1995 - 00:00:00 CEST

Original text of this message