I was getting below exception in my code where my query in the function was perfectly working fine in oracle but in java code giving me this error
org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar [{call schema.package.function(?, ?, ?)}]; nested exception is java.sql.SQLException: Invalid column name
Thanks to this thread
http://forum.spring.io/forum/spring-projects/data/22853-preparedstatementcallback-bad-sql-grammar
I noticed there was no ORA error message in the exception , which means the call was executed successfully in JDBC level , and than I had to check my mapper defined for this execution there I was trying to get a column from resultset which was not selected in the original query hence the problem " java.sql.SQLException: Invalid column name"
Solution
I added the missing column in my query and got rid of this exception. Good Lesson Learned.
org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar [{call schema.package.function(?, ?, ?)}]; nested exception is java.sql.SQLException: Invalid column name
Thanks to this thread
http://forum.spring.io/forum/spring-projects/data/22853-preparedstatementcallback-bad-sql-grammar
I noticed there was no ORA error message in the exception , which means the call was executed successfully in JDBC level , and than I had to check my mapper defined for this execution there I was trying to get a column from resultset which was not selected in the original query hence the problem " java.sql.SQLException: Invalid column name"
Solution
I added the missing column in my query and got rid of this exception. Good Lesson Learned.
Lesson Learned : If there is no ORA error in your exception chances are that the JDBC call was ok and now something wrong in your java code .