Query related to cursor
Posted: Wed Jan 07, 2009 1:21 pm
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???
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???