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.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
vqj1592443206677.ditamap
dita:ditavalPath
vqj1592443206677.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantageā„¢

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

The returning form of COMMENT returns data.

ANSI Compliance

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

Required Privileges

None.

Invocation

Executable.

Embedded SQL only.

Syntax

COMMENT [ON] object_kind object_reference
  INTO [:] host_variable_name
  [ [ INDICATOR ] :host_indicator_name ]

Syntax Elements

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.

Usage Notes

  • 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.