Home » SQL & PL/SQL » SQL & PL/SQL » Order by problem
Order by problem [message #200381] Mon, 30 October 2006 10:32 Go to next message
Messages: 2
Registered: October 2006
Junior Member
I have a query in a stored procedure which looks like :

PROCEDURE stored_proc_ex
--Input parameters for the procedure
(i_param1 IN VARCHAR2,
i_param2 IN VARCHAR2,
..... other parameters
i_order_by IN VARCHAR2,
i_sort IN VARCHAR2)
--some code in static PL/SQL
order by i_order_by||' '||i_sort)
end stored_proc_ex;

Here the columns to be ordered by are variable and so is the sort by (ASC or DESC).
I want to execute this procedure without using Dynamic SQL. How can this be achieved ?
Re: Order by problem [message #200387 is a reply to message #200381] Mon, 30 October 2006 11:30 Go to previous messageGo to next message
Messages: 381
Registered: September 2006
Location: UK
Senior Member
The only alternative to using dynamic SQL would be to load all the data into an array in memory and write a routine to bubble sort it yourself. I recommend you use dynamic SQL.
Re: Order by problem [message #200414 is a reply to message #200387] Mon, 30 October 2006 18:00 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Previous Topic: Populating Text File with records from a table
Next Topic: Format the SQL Result
Goto Forum:

Current Time: Tue Oct 25 20:08:12 CDT 2016

Total time taken to generate the page: 0.05603 seconds