17.05 - Example: Using SET QUERY_BAND … FOR TRANSACTION As a Parameterized JDBC Request - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1144-175K
Language
English (United States)

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