I have a query that works fine if I run the sql in a JDeveloper SQL editor, but I get a "java.sql.SQLException: Invalid column index" error if I paste it in a database adapter. If I put this query in the adapter:
select <column>
from <table>
where <column> in (select
trim( substr (txt,
instr (txt, ',', 1, level ) + 1,
instr (txt, ',', 1, level+1)
- instr (txt, ',', 1, level) -1 ) )
as token
from (select ','||#bindVariable||',' txt
from dual)
connect by level <=
length(#bindVariable)-length(replace(#bindVariable,',',''))+1)
I get the error. But if I just put the sub query in the adapter as:
select
trim( substr (txt,
instr (txt, ',', 1, level ) + 1,
instr (txt, ',', 1, level+1)
- instr (txt, ',', 1, level) -1 ) )
as token
from (select ','||#bindVariable||',' txt
from dual)
connect by level <=
length(#bindVariable)-length(replace(#bindVariable,',',''))+1
the error goes away. Does anyone know what might be causing this?
Thanks in advance