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 -- //www.freelists.org/webpage/oracle-l