you can use the "dbms_output" package to display value of a variable in a PL/SQL procedure.
If it is a simple sql script you can prompt the value.
For example, following statement displayes the value of variable aj.
To be technically correct on this topic, in AvJoshius's example above, "aj" is not a "variable" it is a SQL*Plus "defined literal"; if it was truly a "variable", then you should be able to "vary" it with some sort of statement like "define aj = aj+1", which you cannot.
You create SQL*Plus (bind) variables with the syntax:
"variable x number"
To assign values, you can do so with this syntax:
"exec :x := 18"
To display the variable's value, you have a couple of options:
"select :x from dual;"
:X
----------
18
or:
"exec dbms_output.put_linex)"
18
To "vary" the value of a variable, you may say:
"exec :x := :x+2"
"exec dbms_output.put_linex)"
20
I hope this clarifies things a bit.
Dave
Sandy, Utah, USA @ 19:02 GMT, 12:02 Mountain Time
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.