Oninit® SQLMorph — Statements and Types
Types
SMALLINT, INTEGER, BIGINT, SERIAL, FLOAT, SMALLFLOAT, DECIMAL, MONEY, CHAR, VARCHAR, LVARCHAR, DATE, BOOLEAN,
DATETIME and INTERVAL (any qualifier except one that starts at FRACTION), flat and nested RECORDs of those,
and ARRAYs (see Records and Arrays). LIKE table.column needs
--schema. TEXT and BYTE are not converted yet.
Statements
| Group | Supported |
|---|---|
| Assignment | LET, including s[i,j] substring assignment and whole-record copy; INITIALIZE ... TO NULL on variables, array elements and rec.* (LIKE also gives NULL). |
| Control flow | IF, WHILE, FOR with STEP, CASE with or without a subject, EXIT, CONTINUE, GOTO / LABEL. A FOR limit or step that is a variable or expression is read again on every pass, as in c4gl. |
| Calls | CALL, calls inside expressions, RETURN of up to eight values, CALL f() RETURNING a, b, recursion. |
| SQL | See Embedded SQL. |
| Other | Line-mode DISPLAY, SLEEP, EXIT PROGRAM / STOP (raised as an SQL error), WHENEVER ERROR / NOT FOUND. |
Built-in functions and operators
LENGTH UPSHIFT DOWNSHIFT ASCII DATE DAY MONTH YEAR WEEKDAY MDY ABS SQRT POW EXP LOG10 LOGN ROOT ROUND TRUNC
SIN COS TAN ASIN ACOS ATAN ATAN2 CURRENT EXTEND TODAY, and the operators CLIPPED, USING,
MATCHES, LIKE (with ESCAPE), BETWEEN, IN, IS NULL, UNITS,
|| and MOD.
DATETIME and INTERVAL
Arithmetic, comparison, CURRENT, EXTEND, UNITS, literals and string conversion are
implemented in the SQLMorph runtime rather than the engine’s helper library, which the engine does not export.
A computed value carries its qualifier (dt + iv keeps the DATETIME’s, dt - dt is an
interval of the right class), so it can be passed to another function or returned directly. The runtime’s rules
were compared against the engine over tens of thousands of generated cases.
Strings and numbers
CHARvalues are blank-padded and compared that way;CLIPPEDtrims.DECIMALarithmetic is exact to 32 significant digits and checks for overflow.USINGsupports numeric masks (#&*<,.-+$and parentheses) and date masks.- Date arithmetic uses the 4GL epoch;
DBDATEgoverns text conversion.