I’m having some trouble executing a nested sql query. It works fine when i run it on TOAD (for Oracle DB) but when I try and execute the same query from my java program it gives me an error : ORA-00923: FROM keyword not found where expected:
Here is the query:
Select *
from(select tb1.Number, tb1.Desc, tb1.Local, tb2.Division
from tb1
inner join tb2
on tb1.Number = tb2.Number
and Local in ('ENG_USA', 'ENG_CHINA', 'FR_FRENCH'))
where Number in ('7512','4706')
Like I mentioned, it executes fine on Toad and is able to retrieve data but the same query throws the ORA-00923 exception.
rset = stmt.executeQuery(Select *
from(select tb1.Number, tb1.Desc, tb1.Local, tb2.Division
from tb1
inner join tb2
on tb1.Number = tb2.Number
and Local in ("+loc+"))
where Number in ("+s+")
Reply With Quote
I had a similar issue with mysql. My problem was that i splitted the query in multiple rows without leaving a space between 2 rows.
So your query should be:
PS: I would like to write this as a comment but for some reason i can’t in this question. Sorry!