Sorting a cursor in stored procedure [message #36048] |
Thu, 01 November 2001 08:35 |
CARLOS
Messages: 24 Registered: February 2000
|
Junior Member |
|
|
Dear experts,
I've created a cursor in the stored procedure in the following way,
...
Open vCursor for
SELECT * FROM tableA
....
The question is, I want to know, if I want to provide the user the flexibility of sorting this cursor by
different column, how can I sort this cursor?
It seems that I can't sort like the following
SELECT * FROM vCursor<----NOT a table
ORDER BY (xyz)<----column name that user desired.
do anyone get any idea? Pls advise!!!!
----------------------------------------------------------------------
|
|
|
Re: Sorting a cursor in stored procedure [message #36049 is a reply to message #36048] |
Thu, 01 November 2001 08:56 |
Sudhakar Atmakuru
Messages: 58 Registered: May 2001
|
Member |
|
|
Pass the sorting key as an input parameter to the stored procedure and use it in the SELECT statement of the CURSOR declaration. Hope it works and resolve your problem.
Good luck :)
----------------------------------------------------------------------
|
|
|
|
|
Re: Sorting a cursor in stored procedure [message #36068 is a reply to message #36048] |
Fri, 02 November 2001 05:50 |
neel
Messages: 12 Registered: November 2001
|
Junior Member |
|
|
Hi Carlos,
I am trying a similar kind of procedure, can u post ur procedure on the forum, so that i can get some idea.
Thanks
Neel
----------------------------------------------------------------------
|
|
|
|