Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Can I create a generic stored procedure to sort any column passed as input : msg#00183

db.maxdb

Subject: Can I create a generic stored procedure to sort any column passed as input parameter???


Hi,

I have been trying to write a generic stored procedure to sort any column
number passed as input parameter to the stored procedure.

I have to think of this, because there are total 10 columns in the table and we
want sorting on each column. We can write separate stored procedure for each
column to sort on, but that is a huge work and not the good solution. Hence I
tried to write a generic stored procedure. But somehow this is not working and
though it compiles properly. But when I try to call it, I get the general error.

One thing I would like to point out that we dont want to move this to
programming task and want to do everything at the db layer side, so that
performance of the system wont affect.

Can anybody let me know whether it is possible to write a generic stored
procedure to sort any column passed as input parameter????

If yes, please let me know.

If not, is there any other way of doing all this????

Well here is the code of that generic stored procedure.

CREATE DBPROC SORTCOLUMN(IN COLUMNNO INT) RETURNS CURSOR AS

$CURSOR = 'ReturnCursor';

DECLARE $CURSOR CURSOR FOR

SELECT JOBS.JOBID, JOBS.JOBNO, JOBS.FOLDERNAME, JOBS.STARTTIME FROM
PMP_OWNER.JOBS ORDER BY :columnNo;



---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo