1.1

Table Of Contents
SQRT function
Returns the square root of a oating point number; only the built-in types REALExamples on page 611,
FLOATSyntax in CREATE TABLE on page 609, and DOUBLE PRECISION on page 609 are supported. The
return type for SQRT is the type of the parameter.
Note: To execute SQRT on other data types, you must cast them to oating point types.
Syntax
SQRT(FloatingPointExpression)
Examples
-- throws an exception if any row stores a negative number:
VALUES SQRT(3421E+09)
-- returns the square root of an INTEGER after casting it as
a
-- floating point data type:
SELECT SQRT(myDoubleColumn) FROM MyTable
VALUES SQRT (CAST(25 AS FLOAT));
SUBSTR function
The SUBSTR function acts on a character string expression or a bit string expression. The type of the result is
a VARCHARSyntax in CREATE TABLE on page 613 in the rst case and VARCHAR FOR BIT DATASyntax
in CREATE TABLE on page 614 in the second case. The length of the result is the maximum length of the source
type.
Syntax
SUBSTR({ CharacterExpression },
StartPosition [, LengthOfString ] )
The parameter startPosition and the optional parameter lengthOfString are both integer expressions. The rst
character or bit has a startPosition of 1. If you specify 0, SQLFire assumes that you mean 1.
The parameter characterExpression is a CHAR, VARCHAR, or LONG VARCHAR data type or any built-in
type that is implicitly converted to a string (except a bit expression).
For character expressions, the startPosition and lengthOfString parameters refer to characters. For bit expressions,
the startPosition and lengthOfString parameters refer to bits.
If the startPosition is positive, it refers to position from the start of the source expression (counting the rst
character as 1). The startPosition cannot be a negative number.
If the lengthOfString is not specied, SUBSTR returns the substring of the expression from the startPosition to
the end of the source expression. If lengthOfString is specied, SUBSTR returns a VARCHAR or VARBIT of
length lengthOfString starting at the startPosition. The SUBSTR function returns an error if you specify a negative
number for the parameter lengthOfString.
vFabric SQLFire User's Guide568
vFabric SQLFire Reference