467,114 Members | 1,306 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,114 developers. It's quick & easy.

Cursors

I have created sql that I tested out using microsoft sql server (since I'm more familiar with it) and it works. When I try to run it in db2, I'm running into problems with a cursor definition. I'm not sure if I need this in a stored procedure, or there's some other problem with what I'm trying to do. I'm using advanced query tool to run my sql statement. Here's part of my code:

DECLARE GLOBAL TEMPORARY TABLE SESSION.TEMP_org
(
agmt_id decimal(15),
rol_plyr_anchr_id decimal(15),
depth_fm_parnt smallint,
full_nm varchar(100)
);

--load temp_org


DECLARE policy_cursor CURSOR
FOR SELECT rol_plyr_anchr_id FROM SESSION.TEMP_pol;

OPEN policy_cursor;

The declare temp table is okay, but it doesn't seem to like my declare of my policy_cursor. I'm receiving the following error message:

42601(-104)[IBM][CLI Driver][DB2/AIX64] SQL0104N An unexpected token "DECLARE POLICY_CURSOR CURSOR FOR SELECT" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<space>". SQLSTATE=42601
Any suggestions would be much appreciated. I am a novice at DB2.

Thanks, Yolanda
Sep 6 '07 #1
  • viewed: 1118
Share:

Post your reply

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

Similar topics

11 posts views Thread by Alban Hertroys | last post: by
22 posts views Thread by T.S.Negi | last post: by
5 posts views Thread by Todd Huish | last post: by
6 posts views Thread by a | last post: by
5 posts views Thread by Boni | last post: by
7 posts views Thread by H. Williams | last post: by
17 posts views Thread by vishal | last post: by
1 post views Thread by Dima Kuchin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.