I want to replace the domain name using cursor without a loop, which is an explicit cursor. but I also want to changes all the same domain names in the database by given pass a string. example: exec PR_Q3( 'usa.com','hotmail.com'); all the domain name with 'usa.com'in database will change to 'hotmail.com'.
create or replace procedure PR_Q3
(old_email in varchar2, new_email in varchar2)
authid current_user
is
cursor E_info is select Email_Address from broker
where REGEXP_LIKE (substr(Email_Address, instr(Email_Address,'@')+1), old_email);
v_email E_info%rowtype;
begin
open E_info;
loop
fetch E_info into v_email;
exit when E_info%notfound;
update broker set
Email_Address = replace(Email_Address,substr(Email_Address,instr(Email_Address,'@')+1),new_email)
where Email_Address = v_email.Email_Address;
end loop;
close E_info;
end PR_Q3;
it works if I delete the loop, but it only changes the domain name once. I need changes all the same domain name. I want to do the same thing without a loop. Can I?