SQL和ORACLE函数比较
2008-09-08 12:53:49 来源:WEB开发网 S:SELECT rand() value
O:SELECT sys.dbms_random.value(0,1) value from dual;
13.取符号
S:SELECT sign(-8) value -1
O:SELECT sign(-8) value from dual -1
14.圆周率
S:SELECT PI() value 3.1415926535897931
O:不知道
15.sin,cos,tan 参数都以弧度为单位
例如:SELECT sin(PI()/2) value 得到1(SQLServer)
16.Asin,Acos,Atan,Atan2 返回弧度
17.弧度角度互换(SQLServer,Oracle不知道)
DEGREES:弧度-〉角度
RADIANS:角度-〉弧度
数值间比较:
18. 求集合最大值
S:SELECT max(value) value from
(SELECT 1 value
union
SELECT -2 value
union
SELECT 4 value
union
SELECT 3 value)a
O:SELECT greatest(1,-2,4,3) value from dual
19. 求集合最小值
S:SELECT min(value) value from
(SELECT 1 value
union
SELECT -2 value
union
SELECT 4 value
union
SELECT 3 value)a
O:SELECT least(1,-2,4,3) value from dual
20.如何处理null值(F2中的null以10代替)
S:SELECT F1,IsNull(F2,10) value from Tbl
O:SELECT F1,nvl(F2,10) value from Tbl
21.求字符序号
S:SELECT ascii('a') value
O:SELECT ascii('a') value from dual
22.从序号求字符
更多精彩
赞助商链接