Neoview SQL Reference Manual (R2.4 SP2)
VALUES Statement
• “Considerations for VALUES”
• “Examples of VALUES”
The VALUES statements starts with the VALUES keyword followed by a sequence of row value
constructors, each of which is enclosed in parenthesis. It displays the results of the evaluation
of the expressions and the results of row subqueries within the row value constructors.
VALUES (row-value-const) [, (row-value-const)]...
row-value-const is:
row-subquery
| {expression | NULL} [,{expression | NULL}...
row-value-const
specifies a list of expressions (or NULL) or a row subquery (a subquer that returns a single
row of column values). An operand of an expression cannot reference a column (except when
the operand is a scalar subquery returning a single column value in its result table).
The results of the evaluation of the expressions and the results of the row subqueries in the
row value constructors must have compatible data types.
Considerations for VALUES
Relationship to SELECT Statement
The result of the VALUES statement is one form of a simple-table, which is part of the
definition of a table reference within a SELECT statement. See the “SELECT Statement” (page 163).
Relationship to INSERT Statement
For a VALUES clause that is the direct source of an INSERT statement, Neoview SQL also allows
the keyword DEFAULT in a VALUES clause, just like NULL is allowed. For more information,
see the “INSERT Statement” (page 143).
Examples of VALUES
• This VALUES statement displays two rows with simple constants:
VALUES (1,2,3), (4,5,6);
(EXPR) (EXPR) (EXPR)
------ ------ -----
1 2 3
4 5 6
--- 2 row(s) selected.
• This VALUES statement displays the results of the expressions and the row subquery in the
lists:
VALUES (1+2, 3+4), (5, (select count (*) from t));
(EXPR) (EXPR)
------ ----------------- ------
3 7
5 2
--- 2 row(s) selected.
208 SQL Statements