当前位置:网站首页>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
边栏推荐
- (ES6 and above and TS) Map object to array
- Favorites|Mechanical Engineer Interview Frequently Asked Questions
- 浏览器存储
- JS数据类型转换完全攻略
- Promise learning (1) What is Promise?how to use?How to solve callback hell?
- 各位大拿,安装Solaris 11.4操作系统,在安装数据库依赖包的时候包这个错,目前无原厂支持,也无安装盘,联网下载后报这个错,请教怎么解决?
- Hot review last week (7.25 7.31)
- 重庆市大力实施智能建造,推动建筑业数字化转型,助力“建造强市”
- [Community Star Selection] Issue 24 August Update Plan | Keep writing, refuse to lie down!More original incentive packages, as well as Huawei WATCH FIT watches!
- Data frame and remote frame of CAN communication
猜你喜欢
CAN通信的数据帧和远程帧
重磅消息 | Authing 实现与西门子低代码平台的集成
Sparse representation - study notes
阿里云官方 Redis 开发规范
Promise learning (4) The ultimate solution for asynchronous programming async + await: write asynchronous code in a synchronous way
表达式引擎在转转平台的实践
Stone Technology builds hard-core brand power and continues to expand the global market
故障007:dexp导数莫名中断
How to use DevExpress controls to draw flowcharts?After reading this article, you will understand!
Pytest e-commerce project combat (below)
随机推荐
[Open class preview]: Research and application of super-resolution technology in the field of video quality enhancement
pandas连接oracle数据库并拉取表中数据到dataframe中、筛选当前时间(sysdate)到一个小时之前的所有数据(筛选一个小时的范围数据)
.NET性能优化-使用SourceGenerator-Logger记录日志
R language ggplot2 visualization: use ggpubr package ggscatter function visualization scatterplot, use xscale wasn't entirely specified X axis measurement adjustment function, set the X coordinate for
(ES6 and above and TS) Map object to array
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
Aeraki Mesh 正式成为 CNCF 沙箱项目
What is MNIST (what does plist mean)
Apex installation error
万字解析:vector类
易周金融分析 | 银行ATM机智能化改造提速;互联网贷款新规带来挑战
【随心笔记】假期快过去了,都干了点什么
How to successfully pass the CKA exam?
How to get the address of WeChat video account (link address of WeChat public account)
Transfer learning to freeze the network:
【公开课预告】:超分辨率技术在视频画质增强领域的研究与应用
MMF的初步介绍:一个规范化的视觉-语言多模态任务框架
STM32 CAN filter configuration details
How to use DevExpress controls to draw flowcharts?After reading this article, you will understand!
【likeshop】回收租凭系统100%开源无加密 商城+回收+租赁