informix
Informix Guide to SQL: Syntax
Segments

Literal Row

The Literal Row segment specifies the syntax for literal values of named row types and unnamed row types. For syntax that allows you to use expressions that evaluate to field values, see ROW Constructors.

Syntax

Usage

You can specify literal values for named row types and unnamed row types. The literal row value is introduced with a ROW constructor. The entire literal row value must be enclosed in quotes.

The format of the value for each field of the row type must be compatible with the data type of the corresponding field.

Field Literal Value

Element Purpose Restrictions Syntax
literal_opaque_type Literal representation for an opaque data type Must be a literal that is recognized by the input support function for the associated opaque type. Defined by the developer of the opaque type.
literal_BOOLEAN Literal representation of a BOOLEAN value A literal BOOLEAN value can only be 't' (TRUE) or 'f' (FALSE) and must be specified as a quoted string. Quoted String, p. 4-260

Fields of a row can be literal values for the data types in the following table.

For a Field of Type Literal Value Syntax
BOOLEAN `t' or `f', representing true or false The literal must be specified as a quoted string.
CHAR, VARCHAR, LVARCHAR, NCHAR, NVARCHAR, CHARACTER VARYING, DATE Quoted String, p. 4-260
DATETIME Literal DATETIME, p. 4-231
DECIMAL, MONEY, FLOAT, INTEGER, INT8, SMALLFLOAT, SMALLINT Literal Number, p.4-237
INTERVAL Literal INTERVAL, p. 4-234
Opaque data types Quoted String, p. 4-260 The string must be a literal that is recognized by the input support function for the associated opaque type.
Collection type (SET, MULTISET, LIST) Literal Collection For information on a literal collection value as a column value or as a collection-variable value, see Nested Quotation Marks. For information on literal collection value as literal for a row type, see Literals for Nested Rows.
Another row type (named or unnamed) For information on a row type value as literal a row type, see Literals for Nested Rows

Important: You cannot specify the simple-large-object data types (BYTE and TEXT) as the field type for a row.

Literals of an Unnamed Row Type

To specify a literal value for an unnamed row type, introduce the literal row with the ROW constructor and enclose the values in parentheses. For example, suppose you define the rectangles table, as follows:

The following INSERT statement inserts values into the rect column of the rectangles table:

LIterals of a Named Row Type

To specify a literal value for a named row, type, introduce the literal row with the ROW type constructor and enclose the literal values for each field in parentheses. In addition, you can cast the row literal to the appropriate named row type to ensure that the row value is generated as a named row type. The following statements create the named row type address_t and the employee table:

The following INSERT statement inserts values into the address column of the employee table:

Literals for Nested Rows

If the literal value is for a nested row, specify the ROW type constructor for each row level. However, only the outermost row is enclosed in quotes. For example, suppose you create the following emp_tab table:

The following INSERT statement adds a row to the emp_tab table:

Similarly, if the row string literal contains a nested collection, only the outermost quotation marks that delineate the row string literal are necessary. No quotation marks need surround the nested collection type.

Related Information

Related statements: CREATE ROW TYPE, INSERT, UPDATE, and SELECT

For information on ROW constructors, see the Expression segment. See also the Collection Literal segment.


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved