Hi All,
Oracle: 11.2
I have data like in the table.
I want to use order_num in the filter
with xxc_test
as
(
select '123-A' order_num from dual
)
if order_num 123-A in the table then create with 123-A1
with xxc_test
as
(
select '123-A1' order_num from dual
)
if Order_num in the table 123-A1 then create with 123-A2
with xxc_test
as
(
select '123-A2' order_num from dual
)
if Order_num in the table 123-A2 then create with 123-A3
I wrote like below I know it won't work.
select count(1)
into v_cnt
from xxc_test
where Order_num=c_rec.Order_num || '-A';
if v_cnt <1 then
l_order_num:=c_rec.Order_num || '-A'||v_cnt;
else
l_order_num:=c_rec.Order_num || '-A';
end if;
Can you please help me?
Thank you