File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Declaring variable in Spring batch update SQL query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Declaring variable in Spring batch update SQL query" Watch "Declaring variable in Spring batch update SQL query" New topic
Forums: JDBC Spring
Author

Declaring variable in Spring batch update SQL query

Abhishekshri Shrivastava
Ranch Hand

Joined: Jan 13, 2011
Posts: 31
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Declaring variable in Spring batch update SQL query
 
Similar Threads
how to do an update an application
Problem in I18N in Spring
Can't resolve JDK issue on Mac
SQL error
Table Viewer GUI from a Database