Re: SQLPLUS/Ora7 Multiple Table Deletes?

From: Brian Stanek <bstanek_at_indy.net>
Date: 1995/06/23
Message-ID: <3sepbk$ffa_at_indy-backup.indy.net>#1/1


Gregory E. Buchanan (gbuc_at_edls2.robins.af.mil) wrote:
: We are trying to use a sqlplus script to allow a user to delete
: from 3 different tables by entering the key value ONCE. This is
: what we have to do now:
 

: >> delete from table_1 where field = '&Value';
: >> delete from table_2 where field = '&Value';
: >> delete from table_3 where field = '&Value';
 

: Same value for field, but deleted in 3 tables. However, we get
: an error telling that the code is not ended properly.
 

: QUESTION: Is there a way to have the user enter the key value
: ONCE, but have sql delete it from -3- different tables?
 

: Thank you for your assistance..

Try this script



accept delval prompt 'Enter in value to delete: '
delete from table_1 where field = '&delval';
delete from table_2 where field = '&delval';
delete from table_3 where field = '&delval';


Or you could change your script to:

delete from table_1 where field = '&&Val';
delete from table_2 where field = '&Val';
delete from table_3 where field = '&Val';


A single & uses a variable and will prompt of the variable is not defined. a double & (&&) will use a variable, prompt if not defined, and xdefine the variablex


Brian Stanek                                            Profound Consulting
bstanek_at_indy.net                                        (317) 579-5200
================================================================================
Received on Fri Jun 23 1995 - 00:00:00 CEST

Original text of this message