Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Command-line parameters

Re: Command-line parameters

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Tue, 9 Mar 2004 09:41:59 -0500
Message-ID: <EKCdncL8WNFdStDdRVn-hA@comcast.com>


"Phil Bewig" <pbewig_at_swbell.net> wrote in message news:455f7154.0403090621.5c8ce230_at_posting.google.com...
| Given these two SQL*Plus scripts, stored
| in files named as indicated:
|
| -- parent.sql
| prompt before &1 &2 &3
| start child &1 &3
| prompt after &1 &2 &3
|
| -- child.sql
| prompt child &1 &2
|
| SQL*Plus behaves as follows:
|
| SQL> start parent Arg1 Arg2 Arg3
| before Arg1 Arg2 Arg3
| child Arg1 Arg3
| after Arg1 Arg3 Arg3
|
| I expected that command-line parameters
| would be local to the script where they
| are invoked. But SQL*Plus seems to keep
| a single set of command-line parameters
| that is shared by all scripts, dynamically,
| so that the parameters to one script can
| be modified by a child of that script.
|
| I fixed my script by assigning the input
| parameters to bind variables immediately
| on entry to the script. But this is
| hardly a general solution.
|
| Is this a bug or a feature? How could
| this behavior ever be useful?
|
| Phil

sql*plus scripts are simply a substitute for typing at the SQL> prompt -- there is very little intelligence built in to handle scripts like individual programs

so is this a bug or a feature? yes. ;-)

all variables (DEFINES and binds) are global to the sql*plus session (not the database session) as are all column, break, set, compute, etc settings

you might try using DEFINE variables in your scripts instead of BIND variables -- there's slightly less syntax

ie:

define myscript1 = &1
define myscript2 = &2
define myscript3 = &3

instead of

var myscript1 varchar2(30)
exec :myscript1 = '&1'
.... etc.

;-{ mcs Received on Tue Mar 09 2004 - 08:41:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US