Hi guys, I have a question, I have a stored procedure on AS400 and I see that I can call like this: call library.prcocedure_name(parameters), the object on AS400 is *pgm type. I never worked since now with stored procedure and for this reason I don't have very large knowledge.
I understand that I can call it also on Iseries navigator with SQL interpretor- run sql scripts.
Regarding this stored procedure I have something like this:
create procedure proc_name()
results sets 1
language sql
specific mylibrary.myproc_name
begin
Declare C1 cursor for
select field1, field2, field3, field4, field5, field6 from mylibrary.file1 --- select only some fields
where field3 in (' ', '1') --- with some conditions
order by field6
fetch first 10 row only;
open c1;
update mylibrary.file1
set field2='adsa'
where field5 ='1'
or field6=' '
end;
Can you tell me please how it should work? the update it will be made on the results stored in the cursor? (the criteria specified in the cursor will be available when I make the update or only the criteria specified in the ''where'' clause in update statement?
Thanks in advance.
I understand that I can call it also on Iseries navigator with SQL interpretor- run sql scripts.
Regarding this stored procedure I have something like this:
create procedure proc_name()
results sets 1
language sql
specific mylibrary.myproc_name
begin
Declare C1 cursor for
select field1, field2, field3, field4, field5, field6 from mylibrary.file1 --- select only some fields
where field3 in (' ', '1') --- with some conditions
order by field6
fetch first 10 row only;
open c1;
update mylibrary.file1
set field2='adsa'
where field5 ='1'
or field6=' '
end;
Can you tell me please how it should work? the update it will be made on the results stored in the cursor? (the criteria specified in the cursor will be available when I make the update or only the criteria specified in the ''where'' clause in update statement?
Thanks in advance.
Comment