Code example for PreparedStatement

Methods: close, executeQuery, setInt

0
    try 
    { 
      if (0 == tabRid)
      { // get the maxscn of the prior table 
        stmt = getMaxWindowScnStatement();
        stmt.setInt(1, srcid);
        stmt.setInt(2, Math.max(0, applyLogId - 1));
      } 
      else 
      { 
        stmt = getWindowScnStatement(applyLogId, srcid);
        stmt.setInt(1, tabRid);
      } 
 
      rs = stmt.executeQuery();
      if (rs.next())
      { 
        windowScn = rs.getLong(1);
      } 
    } catch (SQLException e)
    { 
      LOG.error("Error ocurred during getWindowScnforSource", e);
      throw e;
    } finally 
    { 
      if (null != rs)
      { 
        rs.close();
        rs = null;
      } 
      if (null != stmt)
      { 
        stmt.close();
        stmt = null;
      } 
    } 
    return windowScn;
  }