And why not use it? There are people who lend themselves to give an open, fetch, and close, create a thousand variables when one is simplifies everything ..
Using Fetch Into Select all
declare
cursor c_cur is
select 'Ivoti', 'Novo Hamburgo', 'Dois Irmãos' from dual;
v_cid_nome1 varchar2(30);
v_cid_nome2 varchar2(30);
v_cid_nome3 varchar2(30);
begin
open c_cur;
loop
fetch c_cur
into v_cid_nome1, v_cid_nome2, v_cid_nome3;
update cidades set nome = v_cid_nome1 where codigo = 1;
update cidades set nome = v_cid_nome2 where codigo = 2;
update cidades set nome = v_cid_nome3 where codigo = 3;
exit when c_cur%NOTFOUND;
end loop;
close c_cur;
commit;
end;
using Select all
declare
begin
for r_cur in (select 'Ivoti' cid1, 'Novo Hamburgo' cid2, 'Dois Irmãos' cid3 from dual)
loop
update cidades set nome = r_cur.cid1 where codigo = 1;
update cidades set nome = r_cur.cid2 where codigo = 2;
update cidades set nome = r_cur.cid3 where codigo = 3;
end loop;
commit;
end;
But of course the two work, but let alone It gets a lot more clean.
Hugs