I have a list of ids. e.g. (1, 2, 10). Is it possible to use that list as a table in Oracle ?
I mean something like that:
select * from (1, 2, 10) as x, some_table
where x not in some_table.value
You can use with construction
with x as (
select 1 as v from dual
union all
select 2 from dual
union all
select 10 from dual
)
select *
from x, some_table
where x.v not in some_table.value -- <- or whatever condition(s) required
select to_number(regexp_substr(str, '[^,]+', 1, level)) ids
--put your comma-delimited list in the string below
from (select '0,12,2,3,4,54,6,7,8,97' as str from dual)
connect by level <= length(regexp_replace(str, '[^,]+')) + 1
minus
--here comes select from some_table
select level from dual connect by level <= 10;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With