Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Altering the ORDER BY clause based on a parameter

Re: Altering the ORDER BY clause based on a parameter

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Mon, 19 Nov 2007 17:05:51 +0100
Message-ID: <4741b45f$0$19648$426a74cc@news.free.fr>

"jeremy" <jeremy0505_at_gmail.com> a écrit dans le message de news: MPG.21ab61015ac547fb98a4c0_at_news.individual.net...
| In article <4740a498$0$19197$426a74cc_at_news.free.fr>, says...
| >
| > order by decode(p_order_by,1,date_col,2,name_col,3,desc_col...)
| >
|
| Hi Michel, this is what I thought but it runs into problems where the
| p_order_by param's data type differs from that of the column on which
| the order by is to be performed. Get runtime errors such as
|
| ERROR at line 1:
| ORA-01722: invalid number
| ORA-06512: at "WD.MYPROC", line 4
| ORA-06512: at line 1
|
| Any ideas? Also I would need to be able to specify the direction ASC or
| DESC of the query results.
|
| Dynamic SQL the way to go?
|
|
| --
| jeremy
|

Convert all values to string using TO_CHAR...

Regards
Michel Cadot Received on Mon Nov 19 2007 - 10:05:51 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US