Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

COBOL Programming :: Need help on cursor

$
0
0
Author: Chandan1993
Subject: Need help on cursor
Posted: Sun Jun 11, 2017 1:11 pm (GMT 5.5)

Hi All,

i am using cusror to fetch the rows.
ex:
EXEC SQL
DECLARE Emp CURSOR FOR
SELECT EMP-id, LASTNAME,
DEPT, JOB
FROM EMP
Where Dept = 'Manager'

END-EXEC.

EXEC SQL
OPEN Emp
END-EXEC.

EXEC SQL
FETCH Eemp
INTO :EMP-ID,
:NAME2,
:DEPT,
:JOB-NAME
END-EXEC

here cursor will fetch multiple rows.lets say cursor fetched 5 rows only.
and emp-id column value in those fetched rows are (100,101,102,103,104,105) then again i want to fetch the first rows from Emp table where column value = 100,101,102,103,104,105.
(Note:- here in final result i need two rows for each Emp-id column value that will have emp-id = 100,101,102,103,104,105)

----I am using cursor here only to display rows value not for insert/update and delete.

Thanks in Adv.

Chandan kr.
_________________
Thanks,
Chandan kumar


Viewing all articles
Browse latest Browse all 8500

Trending Articles