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

Declaring variable in Spring batch update SQL query

 
Abhishekshri Shrivastava
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to execute a batchupdate for sybase in spring java. I am using NamedParameterJdbcTemplate for that.
I have to use a variable in SQL to check return value. e.g. SQL -->



above query works fine for single update but issue come in case of batchupdate. I see below error and it's expected in case of batchupdate for the query. I wanted to know what should be the approach to do such kind of operation for a batch update (how to use a variable).

BatchUpdateException: Error occurred while executing batch statement: The variable name '@r' has already been declared. Variable names must be unique within a query batch or stored procedure.
; nested exception is com.sybase.jdbc3.jdbc.SybBatchUpdateException: JZ0BE: BatchUpdateException: Error occurred while executing batch statement: The variable name '@r' has already been declared. Variable names must be unique within a query batch or stored procedure.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic