Datatypes

SPLASH uses the standard CCL datatypes integer, string, float, long, money, money(n), date, timestamp, bigdatetime, interval, binary, and boolean.

Datatype Description
integer

A signed 32-bit integer. The range of allowed values is -2147483648 to +2147483647 (-231 to 231-1). Constant values that fall outside of this range are automatically processed as long datatypes.

To initialize a variable, parameter, or column with a value of -2147483648, specify (-2147483647) -1 to avoid compiler errors.

long

A signed 64-bit integer. The range of allowed values is -9223372036854775808 to +9223372036854775807 (-263 to 263-1).

To initialize a variable, parameter, or column with a value of -9223372036854775807, specify (-9223372036854775807) -1 to avoid compiler errors.

float A 64-bit numeric floating point with double precision. The range of allowed values is approximately -10308 through +10308.
string Variable-length character string, with byte values encoded in UTF-8. Maximum string length is platform-dependent, but can be no more than 65535 bytes.
money

A signed 64-bit integer with global precision. Currency symbols and commas are not supported in the input data stream.

money(n)

A signed 64-bit integer that supports varying precision, from 1 to 15 digits after the decimal point. Currency symbols and commas are not supported in the input data stream, however, decimal points are.

The supported range of values change, depending on the specified precision.

money(1): -922337203685477580.8 to 922337203685477580.7

money(2): -92233720368547758.08 to 92233720368547758.07

money(3): -9223372036854775.808 to 9223372036854775.807

money(4): -922337203685477.5808 to 922337203685477.5807

money(5): -92233720368547.75808 to 92233720368547.75807

money(6): -92233720368547.75808 to 92233720368547.75807

money(7): -922337203685.4775808 to 922337203685.4775807

money(8): -92233720368.54775808 to 92233720368.54775807

money(9): -9223372036.854775808 to 9223372036.854775807

money(10): -922337203.6854775808 to 922337203.6854775807

money(11): -92233720.36854775808 to 92233720.36854775807

money(12): -9223372.036854775808 to 9223,372.036854775807

money(13): -922337.2036854775808 to 922337.2036854775807

money(14): -92233.72036854775808 to 92233.72036854775807

money(15): -9223.372036854775808 to 9223.372036854775807

To initialize a variable, parameter, or column with a value of -92,233.72036854775807, specify (-9...7) -1 to avoid compiler errors.

Specify explicit precision for money constants with Dn syntax, where n represents the precision. For example, 100.1234567D7, 100.12345D5.

Implicit conversion between money(n) types is not supported because there is a risk of losing range or precision. Perform the cast function to work with money types that have different precision.

bigdatetime

Timestamp with microsecond precision. The default format is YYYY-MM-DDTHH:MM:SS:SSSSSS.

All numeric datatypes are implicitly cast to bigdatetime.

The rules for conversion vary for some datatypes:

  • All boolean, integer, and long values are converted in their original format to bigdatetime
  • Only the whole-number portions of money(n) and float values are converted to bigdatetime. Use the cast function to convert money(n) and float values to bigdatetime with precision.
  • All date values are multiplied by 1000000 and converted to microseconds to satisfy bigdatetime format.
  • All timestamp values are multiplied by 1000 and converted to microseconds to satisfy bigdatetime format.
timestamp

Timestamp with millisecond precision. The default format is YYYY-MM-DDTHH:MM:SSS.

date Timestamp with millisecond precision. The default format is YYYY-MM-DDTHH:MM:SSS.
interval

A signed 64-bit integer that represents the number of microseconds between two timestamps. Specify an interval using multiple units in space-separated format, for example, "5 Days 3 hours 15 Minutes". External data that is sent to an interval column is assumed to be in microseconds. Unit specification is not supported for interval values converted to or from string data.

When an interval is specified, the given interval must fit in a 64-bit integer (long) when it is converted to the appropriate number of microseconds. For each interval unit, the maximum allowed values that fit in a long when converted to microseconds are:

  • MICROSECONDS (MICROSECOND, MICROS): +/- 9223372036854775807
  • MILLISECONDS (MILLISECOND, MILLIS): +/- 9223372036854775
  • SECONDS(SECOND, SEC): +/- 9223372036854
  • MINUTES(MINUTE, MIN): +/- 153722867280
  • HOURS(HOUR,HR): +/- 2562047788 DAYS(DAY): +/- 106751991

The values in parentheses are alternate names for an interval unit. When the maximum value for a unit is specified, no other unit can be specified or it causes an overflow. Each unit can be specified only once.

binary

Represents a raw binary buffer. Maximum length of value is platform-dependent, but can be no more than 65535 bytes. NULL characters are permitted.

boolean Value is true or false. The format for values outside of the allowed range for boolean is 0/1/false/true/y/n/on/off/yes/no, which is case-insensitive.
Programs in SPLASH automatically convert values of numeric type to other types if possible.
float e := 2.718281828459;
integer years := 10;
If you declare the above, then the following expression is a legal expression with datatype float:
1000.0d * (e ^ (0.05 * years))
The variable years of type integer is automatically converted to float, as is the constant 1000.0d of type money.
If necessary, use the cast operation to downcast values (convert a number with more precision into a number with less precision). For instance, this expression converts the float value into an integer by truncating the decimal part of the number:
cast(integer, 1000.0d * (e ^ (0.05 * years)))

You can compute with values of datatype date, timestamp and bigdatetime just as if they are numeric values. For example, if you add 10 to a date value, the result is a date value ten seconds in the future. Likewise, if you add 10 to a timestamp value, the result is a timestamp value ten milliseconds in the future. The precision is thus implied in the type.