Re: Help ! Storing value in temp variable in sqlplus

From: Bernd Koessl <bkoessl_at_hexal.spacenet.de>
Date: 1995/07/06
Message-ID: <3tg9km$k19_at_euler.space.net>#1/1


pmccarth_at_rpc.unb.ca (Patrick McCarthy) wrote:

>Qualifier :> I am a novice user.
Everyone life has a beginning.

>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.

Im not sure that I understand your intention. You don't need a temporary variable to solve this problem. You can put the first select (with the max(value)) into the insert-script. Here is an simple example :
insert into TABLE2 (row)
select max(row)+1 from TABLE1;

I hope this helps you ;-]

Bye
Bernd

>Any help would be greatly appreciated.
 

>Thanks in advance.
 

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

                  \|/
                 (o o)
--------------oOo (^) oOo-------------------------------------
\ Bernd Koessl             email : bkoessl_at_hexal.spacenet.de /
 \                    Compuserve : 100635,1514              /
  \--------------------------------------------------------/
   \    Hexal Pharma GmbH                                 /
    \   Industriestr.25         Angerstrasse 8           /
     \  83607 Holzkirchen       83043 Bad Aibling       /
      \ 49-8024-908387          49-8061-36693          /
       ------------------------------------------------
Received on Thu Jul 06 1995 - 00:00:00 CEST

Original text of this message