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