=expression

Description:

Through the esProc JDBC, execute the statement directly and return the result set

Syntax:

=expression

Note:

This statement works similarly to an expression in the esProc calculation cell. The Statement can be generated by directly using con.createStatement(). Use st.executeQuery() to execute the statement directly, and return the result set. If the statement contains the tab/enter separator, a cellset will be dynamically generated for executing it. Notice that the expression must start with an equal sign. There aren’t necessarily parameters used in the statement; but if there are, they always start with arg.

Parameters:

expression

SQL statement or expression. If there are multiple expressions in the bracket, the expressions will be computed one by one and the value of the last expression will be returned, for example: (arg1=1,arg2=2,arg1+arg2), the return value is 3

Return value:

Result set

Example:

public void testDataServer() {

Connection con = null;

java.sql.PreparedStatement st;

java.sql.Statement st2;

try{

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

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

// Call the stored procedure

st=con.prepareCall("call test(3)");

// Execute statement directly, return result set

ResultSet set = st.executeQuery("=(arg=3,arg+3)");

// Print results

printRs(set);

// Create Statement directly

st2=con.createStatement();     

ResultSet set2 = st2.executeQuery("=(arg=3,arg+4)");

printRs(set2);

// If the statement contains the tab/enter separator, a cellset will be dynamically generated for executing it

ResultSet b =st2.executeQuery("==null\nfor 1,11,5\n\t>A1=A1+A2");

printRs(b);

}

catch(Exception e){

System.out.println(e);

}

finally{

// Close the connection

if (con!=null) {

try {

con.close();

}

catch(Exception e) {

System.out.println(e);

}

}

}

}