当前位置:网站首页>SQL函数 SQRT
SQL函数 SQRT
2022-08-01 12:02:00 【用户7741497】
SQL函数 SQRT
返回给定数值表达式的平方根的数值函数。
大纲
SQRT(numeric-expression)
{fn SQRT(numeric-expression)}参数
numeric-expression- 解析为计算平方根的正数的表达式。
SQRT 返回 NUMERIC 或 DOUBLE 数据类型。如果 numeric-expression 是数据类型 DOUBLE,则 SQRT 返回 DOUBLE;否则,它返回 NUMERIC。
描述
SQRT 返回 numeric-expression 的平方根。 numeric-expression 必须是正数。负数值表达式(-0 除外)会生成 SQLCODE -400 错误。如果传递 NULL 值,SQRT 返回 NULL。
SQRT 返回一个精度为 36、小数位数为 18 的值。
SQRT 可以指定为常规标量函数或 ODBC 标量函数(使用大括号语法)。
示例
以下示例显示了两种 SQRT 语法形式。两者都返回 49 的平方根:
SELECT SQRT(49) AS SRoot,{fn SQRT(49)} AS ODBCSRoot
7 7以下嵌入式 SQL 示例返回整数 0 到 10 的平方根:
/// d ##class(PHA.TEST.SQLFunction).Sort()
ClassMethod Sort()
{
s a = 0
while a < 11 {
&sql(
SELECT SQRT(:a) INTO :b
)
if SQLCODE '= 0 {
w !,"Error code ",SQLCODE
} else {
w !,"The square root of ",a," = ",b
s a = a + 1
}
}
}DHC-APP>d ##class(PHA.TEST.SQLFunction).Sort()
The square root of 0 = 0
The square root of 1 = 1
The square root of 2 = 1.414213562373095049
The square root of 3 = 1.732050807568877294
The square root of 4 = 2
The square root of 5 = 2.236067977499789697
The square root of 6 = 2.449489742783178098
The square root of 7 = 2.645751311064590591
The square root of 8 = 2.828427124746190098
The square root of 9 = 3
The square root of 10 = 3.162277660168379332边栏推荐
- R language ggplot2 visualization: use the ggdensity function of the ggpubr package to visualize density plots, use the stat_central_tendency function to add mean vertical lines to the density and cust
- 【CLion】CLion 总是提示 “This file does not belong to any project target xxx” 的解决方法
- Alibaba Cloud Official Redis Development Specification
- 用户体验 | 如何度量用户体验 ?
- 千万级乘客排队系统重构&压测方案——总结篇
- STM32 CAN filter configuration details
- 安装apex报错
- 腾讯云原生:Areaki Mesh 在 2022 冬奥会视频直播应用中的服务网格实践
- Flutter Widget 如何启用和屏蔽点击事件
- 故障007:dexp导数莫名中断
猜你喜欢
随机推荐
pandas connects to the oracle database and pulls the data in the table into the dataframe, filters all the data from the current time (sysdate) to one hour ago (filters the range data of one hour)
那些利用假期学习的职场人,后来都怎么样了?
稀疏表示--学习笔记
How to use DevExpress controls to draw flowcharts?After reading this article, you will understand!
语音聊天app源码——语音聊天派对
用户体验 | 如何度量用户体验 ?
【云享新鲜】社区周刊·Vol.73- DTSE Tech Talk:1小时深度解读SaaS应用系统设计
(ES6 and above and TS) Map object to array
(ES6以上以及TS) Map对象转数组
Data frame and remote frame of CAN communication
C#/VB.NET 将PPT或PPTX转换为图像
Complete Raiders of JS Data Type Conversion
AI目标分割能力,无需绿幕即可实现快速视频抠图
MMF的初步介绍:一个规范化的视觉-语言多模态任务框架
The four methods of judging JS data type
R语言ggplot2可视化:使用ggpubr包的geom_exec函数执行geom_*函数(没有任何参数需要放置在aes中)
Qt获取文件夹下所有文件
Favorites|Mechanical Engineer Interview Frequently Asked Questions
如何使用 Authing 单点登录,集成 Discourse 论坛?
R language fitting ARIMA model: use the auto.arima function in the forecast package to automatically search for the best parameter combination, model order (p, d, q), set the seasonal parameter to spe






![[5 days countdown] to explore the secret behind the great quality promotion, gift waiting for you to take of $one thousand](/img/de/1e6069e84183d1400c90a6ec574f72.png)


