Jive Types & Variables
Data Types
Jive supports a full range of data types:
- string - variable length text
- int - 32 bit integer
- float - 64 bit integer
- bool - 1 bit logical value (true, false)
- date - year, month, day
- time - hour, minute, second
- timestamp - year, month, day, hour, minute, second, nanosecond
Each data type can have a missing value called null in SQL.
Literal values for each data type:
- string - text surrounded by single or double quotes
- int - optional sign and 1 or more numeric digits
- int - optional sign and numeric digits with decimal point (a leading
decimal point is discouraged)
- bool - true or false - preset variables
- date - yyyy/mm/dd where y, m, d are numeric
digits
- time - hh:mm:ss where h, m, s are numeric
digits
- timestamp - no literal representation
Most reasonable conversions are supported. All data types can be
converted to and from string and to bool. Converting from strings
uses the same format as the literal representation above. A quoted string
literal can be used for timestamp. For example:
var timestamp test_value = '1995/12/31 23:59:59.999999999'
Additionally, a quoted string literal for float can contain exponental
(e) notation. For example,
var float million = '1e+6'
Variables
The var Command is used to create variables.
A variable has a data type and a value. The value of a variable is
assigned with the set Command. A variable
is local to its containing block - a query (select) block,
a while block or the entire Jive text (effectively, global).
Variables in the outer enclosing block can be referenced unless their
name is overridden by a more inner variable definition.
Qualification can be used to reference global variables (using root
as the qualifier) and query result variables. Dot (.) is used as the
qualifier. Multiple qualifiers descend from the left. Inner qualifiers
can be omitted like COBOL.
A variable must contain a value of its defined type, or it must be
null. Nulls in Jive are the same as in SQL. Nulls
can be passed between Jive and SQL databases. null is a keyword
in Jive for a null. For example,
set a = null
A null is also used for uninitialized variables and as the
result of syntax or semantic errors. For example,
set x = y
will set x to null when y is undefined.
Variables can also be created with:
Result column variables are readonly.
Copyright © 1996 FFE Software All Rights Reserved WorldWide