SAND CDBMS SQL Reference Guide
Value Expressions


Value Expression Primaries


These can be used anywhere SAND CDBMS SQL syntax calls for a value expression, for example, in the projection list of a SELECT statement, as new column values in INSERT or UPDATE statements, and in the query expression of a CREATE VIEW statement. A value expression is an argument that evaluates to a single numeric, character string, or date/time value (the data type of the expression must be appropriate to the statement in which it is used). Value expression primaries, which are the "building blocks" of the value expression argument, consist of direct column references, character or numeric constants, functions, the arithmetic operators +, , *, /, and the string concatenation operator ||. A value expression may also contain another value expression enclosed in parentheses.

The value expression argument is described in the following syntax diagram:




column
The column argument specifies the name of a column belonging to a table or view. If the column name is not unique across all the tables used in the query expression, it must be qualified with a table name or alias (correlation name). Only numeric values may be part of an arithmetic operation; only character values can be used with the concatenation operator.

constant
The constant argument specifies a character or numeric literal. A numeric value may be preceded by a unary operator (that is, a or –) to indicate whether it is a positive or negative value. A character string must be surrounded by single quotes. Only numeric values may be part of an arithmetic operation; only character values can be used with the concatenation operator. Refer to the Literals (Constants) section for more information about constant values.

function
A function can be applied to all input values, resulting in a single output value. (See the next section for more details about functions.)

( scalar subquery )
The ( scalar subquery ) argument must return a single value only. If more than one value is returned, an error condition is generated. If the subquery result set is empty, a null value is returned instead. Note that the entire SELECT statement must be contained in parentheses.

 

Topics: