Monday, April 11, 2011

corejava: java.sql.SQLSyntaxErrorException: ORA-01747: inval...

corejava: java.sql.SQLSyntaxErrorException: ORA-01747: inval...: "I got this exception yesterday while trying to execute an insert statement through JDBC and found out that their was an error in the query ,..."

java.sql.SQLSyntaxErrorException: ORA-01747: invalid user.table.column, table.column, or column specification

I got this exception yesterday while trying to execute an insert statement through JDBC and found out that their was an error in the query , following is an example of where I was doing wrong

let's say the orignal working query was initially

insert into abc (a,b,c) values (?,?,?)

then I added another column d in the table abc and updated the above query like

insert into abc (a,b,,c,d) values (?,?,?,?)

when trying to execute above query I was getting this exception , notice that mistakenly I had one extra comma in the field list , I deleted the comma

insert into abc (a,b,c,d) values (?,?,?,?)

and the query was running fine after that.