15.10 - Example: Using SET QUERY_BAND … FOR TRANSACTION As a Parameterized JDBC Request - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

The following example shows how you can specify the SET QUERY_BAND … FOR TRANSACTION request as a parameterized JDBC request.

     public static void main(String args[])
       {
          // Creation of URL to be passed to the JDBC driver
          String url = "jdbc:teradata://borg";
          // Strings representing a prepared statement 
          // and its parameter values
          String ssetqbpm = "SET QUERY_BAND = ? FOR TRANSACTION;";
          String txnqb = "cat=asta;tree=palm;flower=rose;";
   …
          PreparedStatement pstmt = con.prepareStatement(ssetqbpm);
          // Set parameter values indicated by ? (dynamic update)
          pstmt.setString(1, txnqb);