Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic SQL with cursors 1

Status
Not open for further replies.

snotmare

Programmer
Jan 15, 2004
262
US
Hello all!

I have a process that I'm creating that makes use of dynamic SQL (format 4). Part of my process requires that I open a handful of SQL cursors at the same time, but I won't know how many cursors to open until run-time. This would require an array of cursors, but I have been unsuccessful in doing so. I have the following line of code...
Code:
DECLARE sql_curs DYNAMIC CURSOR FOR SQL_DSA[ll_counter];
Is it possible to do something like this...
Code:
DECLARE sql_curs[ll_counter] DYNAMIC CURSOR FOR SQL_DSA[ll_counter];
... or even this...
Code:
DECLARE sql_curs + "_" + ll_counter DYNAMIC CURSOR FOR SQL_DSA[ll_counter];

Or, is there a way to use the same cursor to create multiple result sets without losing any of the previous result sets?

If this is not possible, please let me know and I will explore other methods.

Thank you for your consideration!

He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon
 
You may have better luck (and performance) by dynamically creating a series of datastores to access and manipulate the data. Check out the syntaxfromsql method in the online help for details.

Matt

"Nature forges everything on the anvil of time
 
Hey, that's pretty cool! Thanks for the tip.

He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top