Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not all variables bound

 
Pradeep
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got error not all variables bound

i have to delete record


my query

public static final String GET_FUNDSHARE_DETAILS = "SELECT SHARE_ID,SHARE_TYPE,BASE_CRNCY_CD,ACTIVE, LAUNCH_DT,ISIN,COM_CD,WPKNR,SEDOL,VALOREN,MEX_ID,CUSIP,EURO_CLEAR FROM WK_SHARE WHERE FUND_ID=? and DELETED = '0'";

public static final String AD_SHARE = "insert into wk_share values(?,wk_share_seq.nextval,?,?,?,?,?,?,?,?,?,?,?,?,?)";

public static final String MODIFY_SHARE = "update wk_share set SHARE_TYPE=?,BASE_CRNCY_CD=?,ACTIVE=?,LAUNCH_DT=?,ISIN=?,COM_CD=?,WPKNR=?,SEDOL=?,VALOREN=?,MEX_ID=?,CUSIP=?,EURO_CLEAR=? WHERE SHARE_ID=?";

public static final String DELETE_SHARE = "update wk_share set deleted='1' where fund_id=? and share_id=? ";





my delete fun in dao class:-->


public boolean deleteFundShare(String fundId , String shareId )throws KMSSystemException{

logger.info("ShareToFundDAO :: deleteFundShare :: Inside");
ResultSet resultSet = null;
PreparedStatement preparedStmt = null;
boolean isUpdate = false;
try{
conn = ServiceLocator.getInstance().getConnection();

// Delete Shares
preparedStmt = new LoggableStatement(conn, DELETE_SHARE);
preparedStmt.setString(1, shareId);
SharesToFundDVO sharesToFundDVO = new SharesToFundDVO();
sharesToFundDVO.setDeleted(KMSConstants.ACTIVE_YES);
logger.debug("ShareToFundDAO :: deleteFundShare :: Query to delete share :: "+((LoggableStatement)preparedStmt).getQueryString());

preparedStmt.execute();

isUpdate = preparedStmt.execute();

conn.commit();
ServiceLocator.closeAll(conn,resultSet,preparedStmt);
}catch(SQLException sqlExec){
logger.debug("ShareToFundDAO :: deleteFundShare :: SQLException ::",sqlExec);
throw new KMSSystemException("error.sharestofund.dao.sqlException",sqlExec);
} catch(KMSSystemException kmsExec){
logger.debug("ShareToFundDAO :: deleteFundShare :: KMSSystemException ::",kmsExec);
throw new KMSSystemException("error.sharestofund.dao.kmsException",kmsExec);
}


logger.info("ShareToFundDAO :: deleteFundShare :: Exit");
return isUpdate;
}
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DELETE_SHARE takes two parameters and you are only setting one; share_id, but not fund_id. Separate issue, then it looks like you are going to execute it twice?

Originally posted by pradeep malekar:
i got error not all variables bound

public static final String DELETE_SHARE = "update wk_share set deleted='1' where fund_id=? and share_id=? ";

...
// Delete Shares
preparedStmt = new LoggableStatement(conn, DELETE_SHARE);
preparedStmt.setString(1, shareId);
preparedStmt.execute();

isUpdate = preparedStmt.execute();
...

 
Pradeep
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have done respective changes that erro has gone

but record is not deleted


please see my action class for that


if(null != mode && mode.trim().equals(KMSConstants.MODE_DELETE)){


sharesToFundValidationHelper.deleteFundShare("1233","5" );
forward = mapping.findForward("search");
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by record is not deleted?

Are you really trying to delete the record? From your sql it looks like you are only setting a deleted column (deleted flag) to a certain value. Do you mean the record is not getting updated by your sql now that the error is gone?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic