Order by based on input

Raj K

Order by based on input
Order by based on input

Select col1, col2, col3
from table 1
order by col1 <ASC/DESC>, col2 <ASC/DESC>, col3 <ASC/DESC>

The sort order for col1, col2, col3 are parameters to the program. Can anyone
explain how to parametrize the sort order without using a dynamic sql.


IDUG is pleased to announce a series of upgrades to the DB2-L discussion listserv that are being implemented to improve reliability and the overall user experience of DB2-L. These changes are coming on November 30th. Details at http://www.idug.org

Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm