Hi Guys I am trying to Update some rows like this :
declare
cursor c1 is select core_cust_id, ADDRESS_LINE1, ADDRESS_LINE2, ADDRESS_LINE3,CITY_CODE,
STATE_CODE from crmuser.address where corp_id is not null and
ADDRESSCATEGORY='Mailing';
begin
for i in c1 loop
update crmuser.tradefinance set ADDR_1=i.ADDRESS_LINE1,
ADDR_2=i.ADDRESS_LINE2, ADDR_3=i.ADDRESS_LINE3, CITY_CODE=i.CITY_CODE,
STATE_CODE=i.STATE_CODE
where i.core_cust_id=(select core_cust_id from crmuser.tradefinance where corp_id is not null);
end loop;
end;
i am getting the Error:
ORA-01427: single-row subquery returns more than one row
ORA-06512: at line 7
When I execute
select core_cust_id, ADDRESS_LINE1, ADDRESS_LINE2, ADDRESS_LINE3,CITY_CODE,
STATE_CODE from crmuser.address where corp_id is not null and
ADDRESSCATEGORY='Mailing';
I get 485 records with Which I want to Match the Core_cust_id. When I execute:
select core_cust_id from crmuser.tradefinance where corp_id is not null;
I again get the 485 core_cust Ids to Match the other Core_cust_ids in the Loop…Why is my query returning Multiple records? What should I correct? I am Using Oracle 10g
Try this