-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcursorupdate.sqlrpgle
More file actions
44 lines (30 loc) · 869 Bytes
/
Copy pathcursorupdate.sqlrpgle
File metadata and controls
44 lines (30 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
**free
dcl-s lId Char(10);
dcl-s lName Char(20);
//Cursor with update
//Declare cursor
exec sql
declare customer cursor for
select CustId, CustName
from Case3PF
for update of Custage;
// For update;
//open cursor
exec sql
open customer;
//fetch first cursor
exec sql
fetch cursor into :lId, :lName;
dow sqlcode = 0;
exec sql
update Case3PF
set Custage = 99
where current of customer;
//fetch next cursor
exec sql
fetch customer into :lId, :lName;
enddo;
//close cursor
exec sql
close customer;
*inlr=*on;