Caché SQL Reference
SQRT


A numeric function that returns the square root of a given numeric expression.
Synopsis
SQRT(numericexpression)
{fn SQRT(numericexpression)}
Arguments
Description
SQRT returns a value of
data type NUMERIC, unless
numericexpression is data type DOUBLE, in which case the returned data type is DOUBLE. The returned value has a precision of 36 and a scale of 18.
SQRT can be specified as a regular scalar function or as an ODBC scalar function (with the curly brace syntax).
Examples
The following example shows the two
SQRT syntax forms. Both return the square root of 49:
SELECT SQRT(49) AS SRoot,{fn SQRT(49)} AS ODBCSRoot
The following embedded SQL example returns the square roots of the integers 0 through 10:
SET a=0
WHILE a<11 {
&sql(SELECT SQRT(:a) INTO :b)
IF SQLCODE'=0 {
WRITE !,"Error code ",SQLCODE
QUIT }
ELSE {
WRITE !,"The square root of ",a," = ",b
SET a=a+1 }
}
See Also


ObjectScript function:
$ZSQR
Copyright © 19972019 InterSystems Corporation, Cambridge, MA