SQL/MX 3.2.1 Reference Manual (H06.26+, J06.15+)
SQL/MX Statements
HP NonStop SQL/MX Release 3.2.1 Reference Manual—691117-005
2-258
Considerations for INSERT
The variable specification is a declared host variable with an optional indicator variable.
To insert null into a database, set the indicator variable to a value less than zero.
For more information, see the SQL/MX Programming Manual for C and COBOL.
Requirements for Inserted Rows
Each row to be inserted must satisfy the constraints of the table or underlying base
table of the view. A table constraint is satisfied if the check condition is not false—it is
either true or has an unknown value.
Using Compatible Data Types
To insert a row, you must provide a value for each column in the table that has no
default value. The data types of the values in each row to be inserted must be
compatible with the data types of the corresponding target columns.
Inserting Character Values
Any character string data type is compatible with all other character string data types
that have the same character set. For fixed length, an inserted value shorter than the
column length is padded on the right with single-byte ASCII blanks (HEX 20). If the
value is longer than the column length, string truncation of nonblank trailing characters
returns an error, and the truncated string is not inserted.
For variable length, a shorter inserted value is not padded. As is the case for fixed
length, if the value is longer than the column length, string truncation of nonblank
trailing characters returns an error, and the truncated string is not inserted.
Inserting Numeric Values
Any numeric data type is compatible with all other numeric data types. If you insert a
value into a numeric column that is not large enough, an overflow error occurs. If a
value has more digits to the right of the decimal point than specified by the scale for
the column definition, the value is truncated.
Inserting Interval Values
A value of INTERVAL data type is compatible with another value of INTERVAL data
type only if the two data types are either both year-month or both day-time intervals.
Inserting Date and Time Values
DATE, TIME, and TIMESTAMP are the three SQL/MX datetime data types. A value
with a datetime data type is compatible with another value with a datetime data type
only if the values have the same datetime fields.
Inserting Nulls
In addition to inserting values with specific data types, you might want to insert nulls.
To insert null, use the keyword NULL.










