I am using ORACLE SQL Developer. I have a table Clob_tab haveing column with data type as: Col1 CLOB data in this column is ('27,88,100,25,26')
I want to use this value from this column as subquery into another query: select * from Abc where Col2 not in (select Col1 from Clob_tab ); DATATYPE of Col2 is NUMBER. I want output as : select * from Abc where Col2 not in (27,88,100,25,26);
Is it possible?
I have tried multiple things which are not working like: Convert blob to varchar2 : dbms_lob.substr(MY_FIELD_BLOB_TYPE) Convert varchar2 to Number using regex_replace: select cast(regexp_replace(Col1 , '[^0-9]+', '') as number) from Clob_tab . Using regex_repalce all the commas are disappearing and I am getting 27881002526. I don't want this number. I want the numbers separated by commas.
None of them gives/translates my query to this form:
select * from Abc where Col2 not in (27,88,100,25,26);
('27,88,100,25,26'). Pay attention - this is ONE value. You write where Col2 not in(27,88,100,25,26);. Pay attention - this is a LIST of values. Convert your CSV string to rowset. For example, you may add square brackets converting CSV to JSON ARRAY, and apply JSON_TABLE() function... - Akinain()is limited to 1000 values. Otherwise you need to tokenize the string value into individual elements. Roughly how many rows are involved in each table, and if there are multiple rows in clob_tab how are they related to abc rows? And which version of Oracle are you using? - Alex PooleJSON_TABLE()usage as it is applied in MySQL for CSV parsing may be found, for example, there. I think it can be easily adopted (or maybe even used as-is). - Akina