15.10 - QUERY_BAND - 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

Add a query band to the profile. Defines the set of name-value pairs to set at logon of all users assigned the profile.

You must enclose the set of name=value pairs for the query band with APOSTROPHE characters (').

The number of name=value pairs is limited to the maximum length of the string, which is 2,048 UNICODE characters, including pad characters.

Pair names and values cannot contain any of the following characters:
  • SEMICOLON (;)
  • a null

If an APOSTROPHE character is embedded within a pair name or value, you must type it twice, to escape it. Otherwise, the system interprets it as a pair_name=pair_value string terminator.

Do not specify reserved pair names or values. For a list of reserved query band names and values, see SQL Data Definition Language - Detailed Topics, B035-1184.
QUERY_BAND
Keyword to introduce query band options you specify.
pair_name
Name component of a query band specification.
The maximum size for each pair_name is 128 UNICODE characters. For more information about database object names, see SQL Fundamentals, B035-1141.
pair_value
Value component of a query band specification.
pair_value can be up to 256 UNICODE characters in length.
DEFAULT
All of the values are considered default values that can be overwritten using the SET QUERY_BAND statement for the session or transaction. If the transaction, session, and profile query bands have name-value pairs with the same name, the name-value pair used for Teradata Active Systems Management (TASM) classification is the first one found in a query band searched in the following order:
  • Transaction query band
  • Session query band
  • Profile query band
See SET QUERY_BAND.
NOT DEFAULT
Overwriting the pairs in the profile query band is not permitted. Any pair in a SET QUERY_BAND statement matching a name in the profile query band is discarded from the query band. If the DEFAULT clause is omitted, the profile query band is set to NOT DEFAULT.

Example: Profile Query Band Pairs are Set as the Default

This example sets the query band as the default.

CREATE PROFILE testprofile AS
  QUERY_BAND = ‘IMPORTANCE=batch;’ (DEFAULT);

If a user with the profile testprofile issues the following statement, it will be accepted and the name-value pair used by Teradata Active System Management is IMPORTANCE=OnlineStrategic.

SET QUERY_BAND = ‘IMPORTANCE=OnlineStrategic;’ FOR SESSION;

Example: Profile Query Band Pairs are Not the Default

Because this CREATE PROFILE statement does not include the DEFAULT clause, the profile query band is set to NOT DEFAULT.

CREATE PROFILE salesprofile AS,
  SPOOL = 2e6*(HASHAMP()+1),
  QUERY_BAND = ‘GROUP=sales;AREA=retail;’;

If a user with the profile salesprofile issues the following statement, the GROUP=production pair is removed from the query band because the profile query band pairs cannot be overwritten.

SET QUERY_BAND = ‘GROUP=production;’ FOR SESSION;