views:

76

answers:

1

platform :sql server 2000 java 1.4

String queryStringForCustomer = "{call MIGRATE_CUSTOMERS_FILE(?,?)}";
String queryStringForCard = "{call MIGRATE_CARDS_FILE(?,?)}";
for(int i=0;i<recordIds.size();i++)
{
 if(FileType.equals("1")){
  callableStatement = connection.prepareCall(queryStringForCustomer);
  callableStatement.setString(1,(String)recordIds.get(i));
  callableStatement.setInt(2, 0);
  callableStatement.execute();
 }else {
  callableStatement = connection.prepareCall(queryStringForCard);
  callableStatement.setString(1,(String)recordIds.get(i));
  callableStatement.setInt(2, 0);
  callableStatement.execute();
 }

 callableStatement.close();
}

In below code on excute() call it gives sql exception with message "incorrrect syntax near '{' ".

procedure declaration starting code is below

     CREATE PROCEDURE MIGRATE_CUSTOMERS_FILE    
       @FILE_RECORD_ID VARCHAR(200),    
       @IS_FILE NUMERIC(2) = 1

Please help me out to resolve this bug? If information is insufficient to solve the problem, pls inform.

+1  A: 

Try prepareStatement(...) instead of prepareCall(...).

alygin