IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Dynamic order by clause in a cursor? Is it possible?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Treefarn

New User


Joined: 16 Jun 2005
Posts: 1

PostPosted: Thu Jun 16, 2005 7:32 pm
Reply with quote

I have an application with a web front end with a cobol/db2 back end. The results from DB2 get sent back to the web page 10 at a time. There is an Order by clause which sorts these results by an account #.

If I ask the user on the webpage what column to sort by, is there a way on the mainframe end to alter the cursor, so instead of sorting account #, it could sort by account #7 or name or dollar amount.

What I was picturing was an 'order by x' clause, where x is an integer. Based on what the user indicated on the web page, x would be assigned the column number, and the cursor would sort accordingly.

But that doesn't seem to be possible, as I am getting bind problems, that the order clause is invalid because x is not a column of the results table. (SQL=-208).

Is it possible to do this in the declare cursor statement, other than by writing separate cursors for each possibility?
Back to top
View user's profile Send private message
sangiah

New User


Joined: 10 Jun 2005
Posts: 62

PostPosted: Tue Jun 21, 2005 12:22 pm
Reply with quote

Can u use dynamic sql
Back to top
View user's profile Send private message
kulkarni_alok

New User


Joined: 07 Jul 2005
Posts: 4

PostPosted: Fri Jul 08, 2005 12:06 am
Reply with quote

go to the link Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Rotate partition-logical & physic... DB2 0
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
No new posts To search DB2 table based on Conditio... DB2 1
Search our Forums:

Back to Top