Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Altering the ORDER BY clause based on a parameter
"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
![]() |
![]() |