Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: using variable name in order by
Using dynamic sql.
Igor Neyman, OCP DBA
ineyman_at_perceptron.com
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of
geraldine_2_at_comcast.net
Sent: Tuesday, March 22, 2005 3:16 PM
To: oracle-l_at_freelists.org
Subject: using variable name in order by
Hi,
Is there a limitation whereby I can't substitute the variable (varname)
with literal string such such name or sal in the ORDER BY clause below?
I can use variable in the WHERE clause but not in the ORDER BY.
OPEN emprefcursor FOR
select name from emp where sal>10000 order by varname;
Based on certain conditions, the varname can be name or sal. However, for some reasons, when I ran the procedure, it failed to replace the varname. Any other alternatives to accomplish the same thing?
Thanks.
Geraldine
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Mar 22 2005 - 15:26:27 CST