mghale wrote:
I'm trying to create a cursor and complete some processing against DB2.
I'm using DB2 V8.2 on AIX. I don't wont to create a stored procedure,
I just want to use a regular query editor such as command editor or
DBArtisan.
It seems DB2 doesn't like the cursor syntax in either one of these
tools. Can you use cursours outside of a program or SPROC? and just in
a simple SQL File?
In SQL Server I can use cursors, and everything for that matter right
from Query Analyzer. I guess my question is can I do that same sort of
excercise using the DB2 tools?
I guess the question is what you actually want to do. Usually it's not a
good idea to simply apply some techniques from one system to another.
Understanding how DB2 (and SQL in general) works is probably better in the
long run.
Cursors are also available as normal SQL in the DB2 command line. You can
do this (turning auto-commit off or using holdable cursors):
db2 => DECLARE c1 CURSOR FOR SELECT tabname FROM syscat.tables;
db2 => OPEN c1;
db2 => FETCH FROM c1;
TABNAME
---------------------------------------------------------------------
COORD_REF_SYS
1 record(s) selected.
--
Knut Stolze
DB2 Information Integration Development
IBM Germany