15.10 - FOR SESSION - 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 set of name:value pairs applies to the current session.

You can set a session query band concurrently with an existing transaction query band.

Session query bands are stored in DBC.SessionTbl and are recovered after a system reset. The system populates additional columns in DBC.SessionTbl for a trusted session and uses the information in these session proxy columns to recover a trusted session after a system reset.

The query band for the session remains in effect until the current session ends or until you issue a:
  • SET QUERY_BAND = … FOR SESSION request to reset the query band.
  • SET QUERY_BAND = NONE FOR SESSION request.
You can use SET QUERY_BAND = … FOR SESSION:
  • In a macro definition, as the single request in the macro.
  • With Teradata Parallel Transporter.
You cannot use SET QUERY_BAND = … FOR SESSION in:
  • Multistatement requests.
  • SQL procedure definitions.

All reserved query bands associated with a load or unload utility should be set FOR SESSION to enable their operation across a restart. For more information about reserved query bands, see “SET QUERY_BAND” in SQL Data Definition Language - Detailed Topics, B035-1184 and Teradata Virtual Storage, B035-1179.

VOLATILE
The system does not update the queryband column of DBC.SessionTbl and the FOR SESSION request is equivalent to a FOR TRANSACTION request.
Use caution if you mix SET QUERY_BAND requests. For example, an application can set some name:value pairs FOR SESSION that are saved in DBC.SessionTbl. If you then add query band name:value pairs using the SET QUERY_BAND VOLATILE option, the query band in the DBC.SessionTbl will no longer match the current session query band. In this case, the system restores the query band saved in DBC.SessionTbl on a restart.