Bind Variable and SQL error during statement preparation
Posted
by Abhishek Dwivedi
on Oracle Blogs
See other posts from Oracle Blogs
or by Abhishek Dwivedi
Published on Thu, 5 Jul 2012 05:25:38 +0000
Indexed on
2012/07/05
9:20 UTC
Read the original article
Hit count: 590
/Oracle
I was getting the following exception at run-time.
JBO-27122: SQL error during statement preparation. Statement: SELECT AxEO.A_ID, AxEO.B_ID, AxEO.C_ID, ByEO.A_ID, ByEO.B_ID, ByEO.C_ID, Cz.A_ID, Cz.B_ID, Cz.C_ID FROM ABC_x AxEO, ABC_y ByEO, ABC_z CzEO WHERE AxEO.A_ID = ByEO.A_ID AND CzEO.A_ID = :Bind_PId
I copied and pasted the query on SQL worksheet, replaced :Bind_PId with a valid id, and executed the query. The query worked alright, implying the query was alright. I tried to connect to different DBs but the issue persisted, meaning it was not a DB issue either.
Finally, the root cause was found to be in the concerned VO; one of the bind variables (say Bind_TId) was marked "Required". De-selecting the Required check-box resolved the issue.
In retrospect, the issue looks to be rather straight-forward. However, the error message is not very helpful, if not misleading. Besides, it's counter-intuitive to think that a bind variable which is not being used in a query can cause error while statement preparation. The other bind variable - Bind_TId - was being used in other view criteria, not the view criteria involved in the given query. Still, it was required.
© Oracle Blogs or respective owner