Page 1 of 1

Query related to cursor

PostPosted: Wed Jan 07, 2009 1:21 pm
by Raju
Please help me

Can i define a cursor as mentioned below in my cobol program

EXEC SQL
DECLARE UBO-CURSOR CURSOR WITH HOLD FOR SELECT
OBJECTID1
, COUNT(*)
FROM TMGJOINING A,
TMGPARTJOIN B
WHERE A.JOINING_ID = B.JOINING_ID
AND JOINING_TYPENUMBER = 21
AND PARTICIPANT_TYPENR = 1
GROUP BY OBJECTID1
HAVING COUNT(*) > 1
END-EXEC.

Problem is that i want to fetch the count alongwith objectid1 for this i had defined two host variables WS-OBJECTID1 and WS-COUNT but while compilation time it is giving error that the host variable WS-COUNT is unusable.
Is there any other way to get that count???

Re: Query related to cursor

PostPosted: Thu Jan 08, 2009 1:52 am
by dick scherrer
Hello Raju and welcome to the forum,

Is there any other way to get that count???
I believe not if you use HOLD. . .