#arg

Read(127) Label: jdbc, arguments,

Description:

Define arguments during the execution of a block of multi-row, multi-column code via esProc JDBC.

Syntax:

  #arg=…

Note:

Use this function to define arguments during the execution of a block of multi-row, multi-column code through esProc JDBC. It should be written at the head of the cellset code.

Parameter:

arg

Argument name

Argument value

Example:

To define value of argument n1 as 2 and that of argument n2 as 3, and then compute value of n1+n2, we have the following cellset code:

    public void executeQuery1(){

       Connection con = null;

        java.sql.PreparedStatement ps;   

       try{               

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

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

           String code= "#n1=2\n#n2=3\n=n1+n2";

          Statement st = con.createStatement();

          ResultSet set = st.executeQuery("=" + code);                    

          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 the connection

          if (con!=null) {

          try {

          con.close();

          }

          catch(Exception e) {

          System.out.println(e);

          }

          }

          }     

    }