Вы можете использовать regex_replace()
:
select
regexp_replace(rule_sql, '^.*COUNTRY_CODE IN \(([^)]+)\).*$', '\1') country_code,
regexp_replace(rule_sql, '^.*COMPANY_CODE IN \(([^)]+)\).*$', '\1') company_code,
regexp_replace(rule_sql, '^.*COLLECTION_UNIT_CODE IN \(([^)]+)\).*$', '\1') collection_unit_code
from mytable
Демонстрация на DB Fiddle :
with mytable as (
select 'COUNTRY_CODE IN (''766'') COMPANY_CODE IN (''03'') COLLECTION_UNIT_CODE IN (''000099'')' rule_sql from dual
union all select 'COUNTRY_CODE IN (''624'') COMPANY_CODE IN (''02'') COLLECTION_UNIT_CODE IN (''BE0001'',''000COM'',''000INT'',''00FSCY'')' from dual
)
select
regexp_replace(rule_sql, '^.*COUNTRY_CODE IN \(([^)]+)\).*$', '\1') country_code,
regexp_replace(rule_sql, '^.*COMPANY_CODE IN \(([^)]+)\).*$', '\1') company_code,
regexp_replace(rule_sql, '^.*COLLECTION_UNIT_CODE IN \(([^)]+)\).*$', '\1') collection_unit_code
from mytable
COUNTRY_CODE | COMPANY_CODE | COLLECTION_UNIT_CODE
:----------- | :----------- | :----------------------------------
'766' | '03' | '000099'
'624' | '02' | 'BE0001','000COM','000INT','00FSCY'
Примечание: чтобы удалить оставшиеся кавычки, затем оберните результаты с помощью replace()
:
select
replace(regexp_replace(rule_sql, '^.*COUNTRY_CODE IN \(([^)]+)\).*$', '\1'), '''', '') country_code,
replace(regexp_replace(rule_sql, '^.*COMPANY_CODE IN \(([^)]+)\).*$', '\1'), '''', '') company_code,
replace(regexp_replace(rule_sql, '^.*COLLECTION_UNIT_CODE IN \(([^)]+)\).*$', '\1'), '''', '') collection_unit_code
from mytable
Демо :
COUNTRY_CODE | COMPANY_CODE | COLLECTION_UNIT_CODE
:----------- | :----------- | :--------------------------
766 | 03 | 000099
624 | 02 | BE0001,000COM,000INT,00FSCY