>statement

Read(3277) Label: jdbc, execute statement, result set,

Description:

Generate the contextual execution statement through esProc JDBC and return every possible result set once the statement is executed

Syntax:

>statement

Note:

This statement works similarly to the expression in the esProc execution cell if it contains only a single line. There will be no result set returned once it is executed. If it contains multiple lines separated by tab/enter, every possible result set will be returned once it is executed. In the esProc JDBC, the Statement can be generated by directly using con.createStatement(). Use st.execute() to execute the statement directly. If there are parameters in the statement, they always start with arg.

Parameter:

statement

A statement/a clause

Example:

1.  The statement contains merely a single line:

public void testDataServer() {

Connection con = null;

java.sql.Statement st;

try{

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

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

// Create Statement directly

st=con.createStatement();

// Execute statement directly to perform an operation over the specified data set

boolean b =st.execute(">demo.execute(\"delete from STUDENTS where ID = 1\")");

// Print execution result

System.out.println(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);

}

}

}

}

 

2.  The statement contains multiple lines:

public void testDataServer() {

Connection con = null;

java.sql.Statement st;

try{

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

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

//Create Statement directly

st=con.createStatement();

//Execute Statement and return every possible result set

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

//Print execution result

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);

}

}

}

}