16.20 - Example: Using SET QUERY_BAND … FOR TRANSACTION As a Parameterized JDBC Request - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Content Type
Programming Reference
Publication ID
B035-1144-162K
Language
English (United States)
Last Update
2019-05-24

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