Hi guys,
I have a question here.
I have a GridView to display, the records will be retrieved via Stored Procedure.
My GridView supoports multi column sorting.
The way i came out with is the parse the sort parameters over to the SP.
For example, i will pass these over...
sortColumn = "ID,NAME";
sortType = "ASC,DESC";
My SP will handle and split the variables into respective arrays.
My idea now is to use the array to provide the parameters for the ORDER BY clause in my statement.
Here's a rough sketch of my statement.
SELECT * FROM table_name where ID='123' ORDER BY...
//For loop here formulate the order by clause
For i in 1..array_count
loop
//concatenate and formulate the output
end loop;
So my final query will be ORDER BY ID ASC, NAME DESC;
Right now i am also using a CASE to determine ASC and DESC.
I am also using DECODE to identify which are the columns parsed in by the application.
Is a for loop feasible in this case? If not, any alternatives? Pretty new with PL/SQL stored procedures.
Any help is greatly appreciated.