COMMENT (Returning Form) | Teradata Vantage - COMMENT (Returning Form) - 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

Returns the comment (if any) that belongs to an object.

Invocation

Executable.

Embedded SQL only.

Syntax

COMMENT [ON] object_kind object_reference
  INTO [:] host_variable_name
  [ [ INDICATOR ] :host_indicator_name ]
object_kind
One of these objects:
  • COLUMN
  • DATABASE
  • FUNCTION
  • MACRO
  • PROCEDURE
  • PROFILE
  • ROLE
  • TABLE
  • TRIGGER
  • USER
  • VIEW
object_reference
One of these object references:
  • column name
  • database name
  • macro name
  • procedure name
  • profile name
  • role name
  • table name
  • trigger name
  • user name
  • user-defined function name
  • view name
host_variable_name
The name of the host variable into which the comment is to be placed.
The preceding COLON is optional; however, its use is strongly recommended.
Blanks before and after the colon are optional.
The rules for the name follow the client programming language conventions.
host_indicator_name
The name of the host indicator variable.

ANSI Compliance

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

Authorization

None.

COMMENT Returns Data

The returning form of COMMENT returns data.

Rules for the Returning Form of COMMENT

  • The data type of host_variable_name must be VARCHAR(255).
  • If no comment exists for the specific object, host_indicator_name returns NULL.
  • Although the COMMENT statement returns only one data value (in effect, a single row containing a single column), you can use a selection cursor with a static COMMENT statement. Use the same procedure for the cursor as for a static selection cursor.
  • If you execute a dynamic COMMENT statement, then you must use a dynamic cursor because data is returned. In this case, the same procedure is followed as with dynamic selection.
  • If you use COMMENT with a cursor or as a dynamic SQL statement, then you must omit the INTO clause.