dbTalk Databases Forums  

Dynamic "Orde by" parameter in Oracle Stored procedure

comp.databases.oracle.tools comp.databases.oracle.tools


Discuss Dynamic "Orde by" parameter in Oracle Stored procedure in the comp.databases.oracle.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Amritha
 
Posts: n/a

Default Dynamic "Orde by" parameter in Oracle Stored procedure - 08-16-2010 , 01:53 PM






Hi,

I would like to execute a SELECT * from table1 order by <XYZ>
and get the results into IN OUT cursor.

I want to pass XYZ as input parameter to stored procedure.
It is treating it as string.

For example: if XYZ value is field1, it is executing the SQL statement
as
SELECT * from table1 order by 'field1'
instead of
SELECT * from table1 order by field1

Please help.

Reply With Quote
  #2  
Old   
Gerard H. Pille
 
Posts: n/a

Default Re: Dynamic "Orde by" parameter in Oracle Stored procedure - 08-16-2010 , 02:08 PM






Amritha wrote:

You're sure you did not forget a newsgroup?

Reply With Quote
  #3  
Old   
Carlos
 
Posts: n/a

Default Re: Dynamic "Orde by" parameter in Oracle Stored procedure - 08-16-2010 , 02:27 PM



On Aug 16, 9:08*pm, "Gerard H. Pille" <g... (AT) skynet (DOT) be> wrote:

Quote:
You're sure you did not forget a newsgroup?
Yup:

comp.databases.oracle.annoying

Cheers.

Carlos.

Reply With Quote
  #4  
Old   
Kay Kanekowski
 
Posts: n/a

Default Re: Dynamic "Orde by" parameter in Oracle Stored procedure - 08-18-2010 , 07:55 AM



Hi,
look at "execute immediate"
Build your statement into a varchar variable and then execute it
hth
Kay

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.