Here\'s what I need to be able to do.
I have a List in java which I can convert to comma separate string of IDs like so \"3,4,5,6,1,2\"
I wonder if there\'s way
Something like this:
with ordered_ids as (
select to_number(regexp_substr ('3,4,5,6,1,2','[^,]+',1,level)) as id, level as sort_order
from dual
connect by regexp_substr ('3,4,5,6,1,2','[^,]+',1,level) is not null
)
select t.id
from t_test t
join ordered_ids oi on oi.id = t.id
order by oi.sort_order;
You can probably make the literal '3,4,5,6,1,2'
a parameter for a PreparedStatement but I haven't tested that.