Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Defaulting the parameters in a sqlplus script.
On Tue, 25 May 2004, nospam_at_noway.nohow wrote:
> On 20 May 2004 09:02:05 -0500, Galen Boyer > <galenboyer_at_hotpop.com> wrote: >
> > I'm confused. Isn't that exactly what login.sql does for you? > I must be missing something.
Here is an example of my issue:
Here is my login.sql:
define 1=SETTONOTHING
define 2=SETTONOTHING
Now Login to sql:
sqlplus galen/galen
SQL*Plus: Release 9.2.0.4.0 - Production on Tue May 25 11:25:47 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
What does define say?
SQL> define
DEFINE _CONNECT_IDENTIFIER = "oralocal" (CHAR) DEFINE _SQLPLUS_RELEASE = "902000400" (CHAR) DEFINE _EDITOR = "Notepad" (CHAR) DEFINE _O_VERSION = "Oracle9i Enterprise Edition Release 9.2.0.4.0 - ProductionWith the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.4.0 - Production" (CHAR)
DEFINE _O_RELEASE = "902000400" (CHAR) DEFINE 1 = "SETTONOTHING" (CHAR) DEFINE 2 = "SETTONOTHING" (CHAR)
Okay, this is what I would expect. Lets now run the following file:
prompt &1
prompt &2
Here I am running it:
[BOYERG4] /cygdrive/c/grers/grersrepository/ccrermf/dbms/bin > sqlplus galen/galen @parmfile
SQL*Plus: Release 9.2.0.4.0 - Production on Tue May 25 11:26:53 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SETTONOTHING
SETTONOTHING
Okay, still what I would expect. Now lets pass parameters to
that file:
[BOYERG4] /cygdrive/c/grers/grersrepository/ccrermf/dbms/bin > sqlplus galen/galen @parmfile AA
SQL*Plus: Release 9.2.0.4.0 - Production on Tue May 25 11:27:03 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SETTONOTHING
SETTONOTHING
See. The scriptname is a parameter itself, so I can't pass the
scriptname a parameter.
AA
SETTONOTHING
But, even this would be hokey if it worked. The best would be to
not have to rely on login.sql and instead have the ability to
default the parameters directly in the script so that I wouldn't
have even gotten prompted for &2 and only seen 'AA'.
-- Galen BoyerReceived on Tue May 25 2004 - 10:37:11 CDT