Benoit
Benoit

Reputation: 79185

SQL*plus does not tokenize its command-line arguments properly when the program path contains spaces

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:

Did anyone encounter this problem and had a way to circumvent it?

Upvotes: 6

Views: 875

Answers (1)

Allan
Allan

Reputation: 17429

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"

Upvotes: 2

Related Questions