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!

SQL*Plus substitution variable assignment

gaverillMay 1 2015 — edited May 1 2015

In the Oracle SQL*Plus User's Guide and Reference (11g), in the section documenting the DEFINE command, is the following statement:

"You should avoid defining variables with names that may be identical to values that you will pass to them, as unexpected results can occur. If a value supplied for a defined variable matches a variable name, then the contents of the matching variable are used instead of the supplied value."  -- http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve017.htm#i2697507

It would seem to imply that DEFINEs such as:

DEFINE v1 = 'test'

DEFINE v2 = v1

would result in a V2 value of 'test' ("the contents of the matching variable"), but I am not able to replicate this; my V2 value is, as expected, equal to 'v1'. Does anyone know what this documentation actually means, and how it might be demonstrated?

TIA,

Gerard

This post has been answered by gaverill on May 1 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 29 2015
Added on May 1 2015
7 comments
1,439 views