Skip to Main Content

Oracle Database Free

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

sqlplus argument reset problem

Harry ZhangFeb 19 2025

In sqlplus 23i, if in first script you use argumnet command for 1st parameter as prompt, then later in another script use argument for first parameter and provide default value, the second script still prompting user for input if both scripts run in one login session. I would expect the argument command is reset to the default value one in the second script. Please see below test case.

1.sql
argument 1 prompt "Enter the table name:"
argument 2 default 10

select '&1' "table" from dual;

2.sql
argument 1 default 10
define num_rows = &1

select '&num_rows' num_rows from dual;

Ouput as below(when running 2.sql, it is still prompting Enter the table name:)
=============

SQL> @1.sql
**Enter the table name:**t1
old 1: select '&1' "table" from dual
new 1: select 'test' "table" from dual

tabl
----
t1

1 row selected.

Elapsed: 00:00:00.01
SQL> @2.sql
**Enter the table name:**t2
old 1: select '&num_rows' num_rows from dual
new 1: select 't2' num_rows from dual

NU
--
t2

1 row selected.

Comments

Post Details

Added on Feb 19 2025
1 comment
97 views