hi all,
i'm a newbie in rpg, and i would like to ask about declare cursor for sqlrpgle.
first, i declare a cursor for my select statement, like this:
after that, i'm fetching it to a data structure and close the cursor.
my question, if i want to execute another sql select statement, can i use the cursor that already i declared above? if the answer is yes, then how? i tried to use declare again, it's return error when i compiled it. it said that "Cursor or procedure C_Sql previously declared".
help me please.
thx in advance.
i'm a newbie in rpg, and i would like to ask about declare cursor for sqlrpgle.
first, i declare a cursor for my select statement, like this:
Code:
c/exec sql
c+ declare C_Sql scroll cursor for
c+ select * from EmpTbl
c+ where DeptName = :Dept
c/end-exec
c/exec sql
c+ OPEN C_Sql
c/end-exec
c/exec sql
c+ FETCH Next From C_Sql INTO :Emp##
c/end-exec
*
*
*
c/exec sql
c+ CLOSE C_Sql
c/end-exec
my question, if i want to execute another sql select statement, can i use the cursor that already i declared above? if the answer is yes, then how? i tried to use declare again, it's return error when i compiled it. it said that "Cursor or procedure C_Sql previously declared".
help me please.
thx in advance.




Comment