?i

Read(43) Label: parameter, jdbc,

Description:

  The parameter in a statement to be executed in esProc JDBC.

Note:

  The parameter in a statement to be executed in esProc JDBC. Same as the rule in eval() function, here i specifies the place of a parameter. ?0 represents a sequence of all parameters.

Parameter:

i

Parameter place.

Example:

  public void cs(){

   Connection con = null;

  try{ 

    // Establish connection

    Class.forName("com.esproc.jdbc.InternalDriver");

    con= DriverManager.getConnection("jdbc:esproc:local://");

    String code="?2/?1";

    PreparedStatement pst = con.prepareStatement("="+code); 

    pst.setObject(1,3); 

    pst.setObject(2,6);

    ResultSet set = pst.executeQuery();

    ResultSetMetaData meta = set.getMetaData();

    while (set.next()) {

    for(int i=0; i<meta.getColumnCount(); i++){ 

  System.out.print(set.getObject(i+1) + "\t");

  }

  System.out.println();

  }

    }

    catch(Exception e){

    System.out.println(e);

    }

    finally{

    //Close connection

    if (con!=null) {

    try {

    con.close();

    }

    catch(Exception e) {

    System.out.println(e);

    }

    }

    }

  }

In the preceding code, value of the 1st parameter is 3 and that of the 2nd parameter is 6. Execute statement =?2/?1 is equivalent to computing expression =6/3, which returns 2.0.  By defining String code="?0", the returned result is [3,6].