Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Other Syntax Segments > Collection-Derived Table >

Accessing a Row Variable

The TABLE keyword can make an ESQL/C row variable a collection-derived table. That is, a row appears as a table in an SQL statement. For a row variable, think of the collection-derived table as a table of one row, with each field of the row type being a column of the row. Use the TABLE keyword in place of the name of a table, synonym, or view in these SQL statements:

The DELETE and INSERT statements do not support a row variable in the collection-derived-table segment.

For example, suppose an ESQL/C host variable a_row has the following declaration:

EXEC SQL BEGIN DECLARE SECTION;
   row(x int, y int, length float, width float) a_row;
EXEC SQL END DECLARE SECTION;

The following ESQL/C code fragment adds the fields in the a_row variable to the row_col column of the tab_row table:

EXEC SQL update table(:a_row)
   set x=0, y=0, length=10, width=20;
EXEC SQL update rectangles set rect = :a_row;
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]