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: jeremy <jeremy0505_at_gmail.com>
Date: Mon, 19 Nov 2007 09:00:47 -0000
Message-ID: <MPG.21ab61015ac547fb98a4c0@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
Received on Mon Nov 19 2007 - 03:00:47 CST

Original text of this message

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