Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, will.

Asked: November 04, 2016 - 2:24 pm UTC

Last updated: November 04, 2016 - 3:04 pm UTC

Version: 11g

Viewed 1000+ times

You Asked

Hello,
I created bind variables in a dataset and would like to reference them in a second dataset using "where 1=1". what do I need to put after each variable in the first for the reference to hold?

and Chris said...

Nothing?

Once you've bound the variable references to it in the same session will still have the same value:

SQL> var b1 number;
SQL> exec :b1 := 1;

PL/SQL procedure successfully completed.

SQL> select :b1 from dual;

       :B1
----------
         1

SQL> select :b1 from dual where :b1 = 1;

       :B1
----------
         1


Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library