Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sqlplus and passing system parameters &1 is not getting the value passed

809498Oct 30 2010 — edited Mar 2 2012
We are having an issue with &1 (actual value) being passed to a sql file. I am assuming this is an installation issue, but cant find the answer.

Below I have example 1 where it works on my PC

In a test.sql file I have:
select &1, &2 from dual;
exit;

When sqlplus is called passing 2 parameters on my computer it works as expected by receiving the 2 numbers in the sql file.
C:\>sqlplus scott/tiger @test.sql 1 2

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Oct 30 10:33:10 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

old 1: select &1, &2 from dual
new 1: select 1, 2 from dual

1 2
---------- ----------
1 2

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64
bit Production
With the Partitioning, Data Mining and Real Application Testing options

C:\>

In example 2: Using the same test.sql file that should receive 1 and 2 and select that from dual, on a different computer we are having thiis issue where parameter 1 (&1) is not actually receiving the parameter, but instead receiving glogin.sql as the first parameter???


C:\>sqlplus scott/tiger @test.sql 1 2

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Oct 30 11:09:10 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

old 1: select &1, &2 from dual
new 1: select Files\oracle\product\10.2.0\client_1\sqlplus\admin\glogin.sql, 2
from dual
select Files\oracle\product\10.2.0\client_1\sqlplus\admin\glogin.sql, 2 from dua
l
*
ERROR at line 1:
ORA-00911: invalid character


Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64
bit Production
With the Partitioning, Data Mining and Real Application Testing options

C:\>select &1, &2 from dual;
'select' is not recognized as an internal or external command,
operable program or batch file.
'1' is not recognized as an internal or external command,
operable program or batch file.
'2' is not recognized as an internal or external command,
operable program or batch file.

C:\>

Can you assist on why this is happening?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2012
Added on Oct 30 2010
9 comments
4,241 views