Unnamed row types
An unnamed row type is a group of typed fields that you create with the ROW constructor. An important distinction between named and unnamed row types is that you cannot assign an unnamed row type to a table. You use an unnamed row type to define the type of a column or field only. In addition, an unnamed row type is identified by its structure alone, whereas a named row type is identified by its name. The structure of a row type consists of the number and data types of its fields.
CREATE TABLE student
(
s_name ROW(f_name VARCHAR(20), m_init CHAR(1),
l_name VARCHAR(20) NOT NULL),
s_address ROW(street VARCHAR(20), city VARCHAR(20),
state CHAR(2), zip VARCHAR(9))
);
- f_name
- m_init
- l_name
- street
- city
- state
- zip
INSERT INTO student
VALUES (ROW('Jim', 'K', 'Johnson'), ROW('10 Grove St.',
'Eldorado', 'CA', 94108))
For more information about how to modify columns that are defined on row types, see the IBM® Informix® Guide to SQL: Tutorial.
ROW(a INTEGER, b CHAR(4));
ROW(x INTEGER, y CHAR(4));
For the syntax of unnamed row types, see the IBM Informix Guide to SQL: Syntax. For information about how to cast row type values, see Create and use user-defined casts.
- BIGSERIAL
- SERIAL
- SERIAL8
- BYTE
- TEXT
The database server returns an error when any of the preceding types are specified in the field definition of an unnamed row type.