当前位置:网站首页>SQL function SQRT
SQL function SQRT
2022-08-01 12:41:00 【User 7741497】
SQL function SQRT
A numeric function that returns the square root of a given numeric expression.
Outline
SQRT(numeric-expression){fn SQRT(numeric-expression)}
parameter
numeric-expression
- An expression that resolves to a positive number that computes the square root.
SQRT
returns NUMERIC
or DOUBLE
data types.SQRT
returns DOUBLE
if numeric-expression
is of data type DOUBLE
; otherwise, it returns NUMERIC.
Description
SQRT
Returns the square root of numeric-expression
.numeric-expression
must be a positive number.Negative numeric expressions (except -0
) generate SQLCODE -400
errors.If a NULL
value is passed, SQRT
returns NULL
.
SQRT
returns a value with a precision of 36
and a scale of 18
.
SQRT
can be specified as a regular scalar function or as a ODBC
scalar function (using curly brace syntax).
Example
The following examples show two forms of SQRT
syntax.Both return the square root of 49
:
SELECT SQRT(49) AS SRoot,{fn SQRT(49)} AS ODBCSRoot7 7
The following embedded SQL
example returns the square root of the integer 0
to 10
:
/// d ##class(PHA.TEST.SQLFunction).Sort()ClassMethod Sort(){s a = 0while a < 11 {&sql(SELECT SQRT(:a) INTO :b)if SQLCODE '= 0 {w !,"Error code ",SQLCODE} else {w !,"The square root of ",a," = ",bs a = a + 1}}}
DHC-APP>d ##class(PHA.TEST.SQLFunction).Sort()The square root of 0 = 0The square root of 1 = 1The square root of 2 = 1.414213562373095049The square root of 3 = 1.732050807568877294The square root of 4 = 2The square root of 5 = 2.236067977499789697The square root of 6 = 2.449489742783178098The square root of 7 = 2.645751311064590591The square root of 8 = 2.828427124746190098The square root of 9 = 3The square root of 10 = 3.162277660168379332
边栏推荐
猜你喜欢
如何使用 Authing 单点登录,集成 Discourse 论坛?
How do programmers solve online problems gracefully?
[5 days countdown] to explore the secret behind the great quality promotion, gift waiting for you to take of $one thousand
小程序插件如何帮助开发者受益?
重庆市大力实施智能建造,推动建筑业数字化转型,助力“建造强市”
CAN通信标准帧和扩展帧介绍
CAN通信的数据帧和远程帧
leetcode/submatrix element sum
找出相同属性值的对象 累加数量 汇总
博弈论(Depu)与孙子兵法(42/100)
随机推荐
[5 days countdown] to explore the secret behind the great quality promotion, gift waiting for you to take of $one thousand
稀疏表示--学习笔记
测试发文
一文带你彻底厘清 Kubernetes 中的证书工作机制
The CAN communication standard frame and extended frame is introduced
How to use DevExpress controls to draw flowcharts?After reading this article, you will understand!
表连接详解
Simulation implementation of new of Js handwritten function
SQL函数 %SQLSTRING
.NET性能优化-使用SourceGenerator-Logger记录日志
How to Integrate Your Service Registry with Istio?
Pytest电商项目实战(下)
R语言ggplot2可视化:使用ggpubr包的geom_exec函数执行geom_*函数(没有任何参数需要放置在aes中)
[CLion] CLion always prompts "This file does not belong to any project target xxx" solution
博弈论(Depu)与孙子兵法(42/100)
leetcode/submatrix element sum
formatdatetime function mysql (date sub function)
英特尔全方位打造算力基础,助推“算”赋百业
Find objects with the same property value Cumulative number Summarize
库函数的模拟实现(strlen)(strcpy)(strcat)(strcmp)(strstr)(memcpy)(memmove)(C语言)(VS)