Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Data Types and Expressions > Literal Row >

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:

CREATE ROW TYPE address_t 
(
street CHAR(20), 
city CHAR(15),
state CHAR(2),
zipcode CHAR(9)
);

CREATE TABLE employee 
(
   name CHAR(30),
   address address_t
);

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

INSERT INTO employee (address)
VALUES (
"ROW('103 Baker St', 'Tracy','CA', 94060)"::address_t)
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]