17.10 - Example: Query Band UPDATE Examples - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

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

This example set demonstrates how to specify and use the query band UPDATE option.

This example uses the UPDATE option to add the name:value pairs city:san diego and state:california.

     SET QUERY_BAND = 'city=san diego;' UPDATE FOR SESSION;
     GETQUERYBAND()
     -----------------------------------------------------------------
     =S> city=san diego;
     SET QUERY_BAND = 'state=california;' UPDATE FOR SESSION;
     GETQUERYBAND()
     -----------------------------------------------------------------
     =S> state=california;city=san diego;

This example uses UPDATE to change the value of the name:value pair city:san diego to city:fresno.

     SET QUERY_BAND = 'city=Fresno;' UPDATE FOR SESSION;
     GETQUERYBAND()
     -----------------------------------------------------------------
     =S> 'city=Fresno;state=california;

This example replaces the entire query band by not specifying the UPDATE option.

     SET QUERY_BAND = 'ID=k31293; Job=payroll;' FOR SESSION;
     GETQUERYBAND()
     -----------------------------------------------------------------
     =S> ID=k31293;Job=payroll;