By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,078 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

Order by based on input / DECLARE cursor clause based on parameter

P: 1
Order by based on input
Expand|Select|Wrap|Line Numbers
  1. Select col1, col2, col3
  2. from table 1
  3. 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.


DECLARE cursor clause based on parameter
Expand|Select|Wrap|Line Numbers
  1. DECLARE CURSOR csr1 <SCROLL/NOSCROLL> CURSOR
  2. FOR SELECT col1, col2
  3. FROM table1

Is it possible to parameterize the SCROLL value in DECLARE cursor based on a input to program.
Nov 25 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.