| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

04-07-04, 15:03
|
|
Registered User
|
|
Join Date: Feb 2002
Location: Minneapolis, MN
Posts: 253
|
|
|
Cursors
|
|
Does anyone know of any good place to find examples of cursors? I have looked in both the Application Programming reference and SQL Reference and have found really nothing....
Thanks!
__________________
Anthony Robinson
"If I'm curt with you, it's because time is a factor here. I think fast, I talk fast, and I need you guys to act fast if you want to get out of this. So, pretty please - with sugar on top..."
|
|

04-07-04, 15:36
|
|
Registered User
|
|
Join Date: Jan 2003
Posts: 3,575
|
|
What are you looking for in particular?
Andy
|
|

04-07-04, 16:02
|
|
Registered User
|
|
Join Date: Feb 2002
Location: Minneapolis, MN
Posts: 253
|
|
|
|
Need to select individual values from a table, evaluate them, and then display them.
In SQL Server it was kind of like:
DELCARE CURSOR FOR SELECT........
FETCH VALUE
DO SOMETHING TO IT
WHILE @@FETCHSTATUS=1 (or something, meaning more to get)
FETCH THE NEXT ONE
CLOSE CURSOR
DEALLOCATE CURSOR
I've really only done really basic stuff with cursors in DB2 (in stored procedures for returning a result set).
Again, any suggestions would be appreciated.
__________________
Anthony Robinson
"If I'm curt with you, it's because time is a factor here. I think fast, I talk fast, and I need you guys to act fast if you want to get out of this. So, pretty please - with sugar on top..."
|
|

04-07-04, 16:06
|
|
Registered User
|
|
Join Date: May 2003
Location: USA
Posts: 5,198
|
|
For DB2 Linux, UNIX, and Windows version 8, look in the SQL Reference Vol 2 for the following SQL statements:
delcare cursor
open cursor
fetch
update (where currrent of cursor)
delete (where current of cursor)
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
|
|

04-07-04, 16:26
|
|
Registered User
|
|
Join Date: Feb 2002
Location: Minneapolis, MN
Posts: 253
|
|
I only have access to te version 7 books, and there isn't a whole lot there. Just says this is DECLARE CURSOR <name>...no real examples
Checked SQL Cookbook, too...
__________________
Anthony Robinson
"If I'm curt with you, it's because time is a factor here. I think fast, I talk fast, and I need you guys to act fast if you want to get out of this. So, pretty please - with sugar on top..."
|
|

04-07-04, 18:08
|
|
Registered User
|
|
Join Date: May 2003
Location: USA
Posts: 5,198
|
|
You can download all DB2 manuals from the IBM website. See useful DB2 stuff. The ones in PDF format are searchable (if you have the correct version of Acrobat reader that is free) and they also have PDF hotlinks. I would downlload the entire directory of manuals using a ftp program.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|