Hi All,
My requirement is to compare 2 columns in which one column has coma separated values and the other a number.
The below query changes the comma separated values to rows. But, I am unable to compare it. Can someone please help.
select regexp_substr(emp_num,'[^,]+',1,level) m
from dual
connect BY regexp_substr(emp_num, '[^,]+', 1, level) is not null;
/******************************/
create table test_cust (Emp_id number ,Emp_num varchar2(50) );
insert into test_cust (Emp_id ,Emp_num,) values (123,'1234,5678,4321');
insert into test_cust (Emp_id ,Emp_num,) values (234,'6789');
create table test_cust_child (Emp_id number, Emp_num number);
insert into test_cust_child (Emp_id ,Emp_num) values ('',1234);
insert into test_cust_child (Emp_id ,Emp_num) values ('',5678);
insert into test_cust_child (Emp_id ,Emp_num) values ('',4321);
insert into test_cust_child (Emp_id ,Emp_num) values ('',6789);
/*********************************/
update test_cust_child b
set Emp_id =
(select b.Emp_id from
test_cust a
where a.Emp_num = b.Emp_num);
/***********************************/
Thank you.