passing PL/SQL variables to SQL PLUS

From: Eva Haiden <eva.haiden_at_engnetworld.com>
Date: 2 Apr 2002 13:30:35 -0800
Message-ID: <52046b21.0204021330.5011bd38_at_posting.google.com>



[Quoted] Dear Oracle users,

[Quoted] [Quoted] I am trying to receive information from the user via accept and prompt. Then I would like to insert this information into a table, but before I do that I have to find out the max value of the id field. How can I do this?

verify off
feedback off
echo off

accept firstName prompt 'Enter the first name: ' accept lastName prompt 'Enter last name: '

insert into names
(id,

 first_name,
 last_name)
values
(select max(id) + 1 from names, -- does not work, how can I do this?
 &firstName,
 &lastName);

We don't have and do not want to install a sequence on the id column.

Please help!

Thank you,
Eva Received on Tue Apr 02 2002 - 23:30:35 CEST

Original text of this message