Jive Types & Variables

Data Types

Jive supports a full range of data types: Each data type can have a missing value called null in SQL.

Literal values for each data type:

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 = '12/31/1996 23:59:59.999999999'
Additionally, a quoted string literal for float can contain exponental (e) notation. For example:
var float million = '1e+6'
Like C/C++, adjacent quoted strings are quietly combined. The same type of quotes (single or double) must be used to combine strings.

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, a proc body 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.

This is also true for calls. Jive subroutines can reference variables in the context of the call. It is recommended that this only be used for global variables.

Qualification can be used to reference global variables (using root as the qualifier) and query result variables. Queries may be labelled or use the default label - query, as a qualifier. Dot (.) is used to delimit qualifiers. 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.
[Return to Main Page]
Jive(tm) 2, Copyright © 1997 FFE Software All Rights Reserved WorldWide