SQL programming / SQL portability |
Make sure that SQL statement syntaxes are supported by all target database engines.
Several SQL syntaxes for the INSERT, UPDATE and DELETE statements are supported by the compiler. Some of the syntaxes are IBM® Informix® specific, but will be converted to standard SQL at compile time.
(1) INSERT INTO table (column-list) VALUES (value-list) (2) UPDATE table SET column = value, ... [WHERE condition] (3) DELETE FROM table [WHERE condition]
(4) INSERT INTO table VALUES record.* -- where record is defined LIKE a table from db schema (5) UPDATE table SET (column-list) = (value-list) [WHERE condition] (6) UPDATE table SET {[table.]*|(column-list)} = record.* ... [WHERE condition] -- where record is defined LIKE a table from db schema (7) UPDATE table SET [table.]* = (value-list) [WHERE condition]
For maximum SQL portability, INSERT statements should be reviewed to avoid the SERIAL column from the value list.
INSERT INTO tab (col1, col2, ...) VALUES ( 0, p_value2, ... )
INSERT INTO tab (col2, ...) VALUES ( p_value2, ... )
DEFINE rec LIKE tab.* INSERT INTO tab VALUES ( rec.* ) -- will use the serial column
INSERT INTO tab VALUES rec.* -- without braces, serial column is removed