Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Terminated Insert.

 
Johnny Woosh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there. im having the following error.



Im supposed to do insertion into database.everything is inserted until this line is encountered.the insertion is actually terminated due to the round brackets.how do i actually escape this round bracket so that insertion can continue? any help will be appreciated. thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us the code you use to run this SQL?
 
Johnny Woosh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure..

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You need to make sure when you parse the column name you correctly substring it to a valid column name. Your file must have something like this:

in it, and you need "straight_line=". If you know how the file will always be formatted, you can make the assumption you do (i.e. that a valid field name exists 8 characters in to a line). For a better way of doing this, you could validate what you get before trying to run any SQL with a regular expression. Or you could get the column name with a regular expression in the first place.

(By the way, are you sure you want to update a table with SQL without any where clause? I don't know if this was what you intended - perhaps it was - but that SQL is going to update every row in the table).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic