DATABASE | Teradata Vantage - DATABASE - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
xqq1557098602407.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantage™

Purpose

Specifies a default database.

Invocation

Executable.

Embedded SQL only.

Syntax

DATABASE { database_name | database_name_variable }
database_name
An SQL identifier.
database_name_variable
A host variable.
The colon is mandatory.

ANSI Compliance

DATABASE is a Teradata extension to the ANSI/ISO SQL:2011 standard.

Rules for Using DATABASE

  • Whether specified as database_name or as database_name_variable, the database name must be a valid SQL identifier.
  • If you use the database_name_variable form, the host variable must follow the rules for SQL strings for the client language.
  • You must ensure that your DATABASE specification is consistent with your DATABASE or -db Preprocessor2 specification.

    While the statements and the options need not name the same database, all unqualified object references in the application program must resolve at application execution time to objects that are compatible with the ones they resolve to at precompile time.

  • Referenced objects in multiple databases should use fully qualified names. Name resolution problems may occur if referenced databases contain tables or views with identical names and these objects are not fully qualified. Name resolution problems may even occur if the identically named objects are not themselves referenced.
  • DATABASE is not valid when you specify the TRANSACT(2PC) option to Preprocessor2.