Skip to Main Content

Oracle Database Discussions

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!

#ifndef or #ifdef in SQLPLUS

13030Mar 7 2011 — edited Mar 8 2011
I want to write a SQL*Plus script that has something like an #IFNDEF or #IFDEF at the top.

In otherwords, something like

#IFNDEF my_variable THEN
DEFINE my_variable='N'
#ENDIF

Then later in the body of my program, I can refer to it as usual and know that it will not prompt the user to enter the variable:

BEGIN IF x OR &my_variable = 'Y' THEN ; ... END;

And the main point being that if the variable is set before this script is called, then the above DEFINE will not overwrite it.

Does SQL*Plus provide this capability?

And as you can see above, a bind variable cannot be used.

Preferably in Oracle 10g or earlier.

Edited by: siliconalley on Mar 8, 2011 4:30 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2011
Added on Mar 7 2011
6 comments
1,413 views