I am using SQL*Plus with the following command line:
sqlplus user/pw@TNS @test.sql foo
The contents of test.sql
follow:
SET VERIFY ON
DEFINE argone='&&1'
SELECT '&argone' FROM dual;
EXIT SQL.sqlcode
Results:
C:\Program Files\Oracle Client\whatever\sqlplus.exe
then &&1
evaluates to Files\Oracle
.C:\Oracle\Client\10.2.xx\bin
then &&1
evaluates to foo
.Did anyone encounter this problem and had a way to circumvent it?
SQL*Plus is a command-line tool that provides access to the Oracle RDBMS. SQL*Plus enables you to: Enter SQL*Plus commands to configure the SQL*Plus environment. Startup and shutdown an Oracle database.
Tip. SQL*Plus buffers SQL statements and PL/SQL blocks, but not SQL*Plus commands. For example, the DESCRIBE command would not be buffered but a SELECT statement would be. To help make the distinction, think in terms of where the command is executed.
The SQL*Plus executable is usually installed in $ORACLE_HOME/bin, which is usually included in your operating system PATH environment variable. You may need to change directory to the $ORACLE_HOME/bin directory to start SQL*Plus.
You'll need to use double quotes at both the command line and the define
statement to properly capture the arguments with spaces.
Script:
SET VERIFY ON
DEFINE argone="&&1"
SELECT '&argone' FROM dual;
EXIT SQL.sqlcode
Command line:
sqlplus user/pw@TNS @test.sql "foo bar"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With