易截截图软件、单文件、免安装、纯绿色、仅160KB

SQLServer和Oracle的常用函数对比

1.绝对值
S:select abs(-1) value
O:select abs(-1) value from dual
2.取整(大)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.取整(小)
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.取整(截取)
S:select cast(-1.002 as int) value
O:select trunc(-1.002) value from dual
5.四舍五入
S:select round(1.23456,4) value 1.23460
O:select round(1.23456,4) value from dual 1.2346
6.e为底的幂
S:select Exp(1) value 2.7182818284590451
O:select Exp(1) value from dual 2.71828182
7.取e为底的对数
S:select log(2.7182818284590451) value 1
O:select ln(2.7182818284590451) value from dual; 1
8.取10为底对数
S:select log10(10) value 1
O:select log(10,10) value from dual; 1
9.取平方
S:select SQUARE(4) value 16
O:select power(4,2) value from dual 16
10.取平方根
S:select SQRT(4) value 2
O:select SQRT(4) value from dual 2
11.求任意数为底的幂
S:select power(3,4) value 81
O:select power(3,4) value from dual 81
12.取随机数
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
     --------数值间比较-----------------


相关文档:

Oracle临时表的几种用法及意义

Oracle临时表可以说是提高数据库处理性能的好方法,在没有必要存储时,只存储在Oracle临时表空间中。希望本文能对大家有所帮助。
1 、前言
目前所有使用 Oracle 作为数据库支撑平台的应用,大部分数据量比较庞大的系统,即表的数据量一般情况下都是在百万级以上的数据量。
当然在 Oracle 中创建分区是一种不错的选择,但 ......

Oracle 字符串长度函数


LENGTH calculates length using characters as defined by the input character set. 
LENGTHB uses bytes instead of characters. 
VSIZE returns the number of bytes in the internal representation of expr.
LENGTHC uses Unicode complete characters. 
LENGTH2 uses UCS2 codepoints. 
......

一次现场oracle 9i 性能调优

第一步
   对数据库整体做了一个了解
$ORACLE_HOME/bin/sqlplus "sys/sys061201 as sysdba" << EOF
spool peiyz_healthcheck_info.txt
set linesize 200
set pagesize 1000
set time on
set timing on
col owner for a10
col segment_name for a30
col index_name for a30
col table_name for a ......

SQLServer 优化SQL语句:in 和not in的替代方案


原文出处:http://www.cnblogs.com/luoht/archive/2010/03/01/1676049.html
用IN写出来的SQL的优点是比较容易写及清晰易懂,这比较适合现代软件开发的风格。
  但是用IN的SQL性能总是比较低的,从SQL执行的步骤来分析用IN的SQL与不用IN的SQL有以下区别:
  SQL试图将其转换成多个表的连接,如果转换不成功则先执行 ......

sqlserver 基础知识大整理

                              SQL-Structured Query Language
--(开启SQL服务:net start mssqlserver)
--(在命令行中输入'sqlwb'命令可打开SQL管理器 )
--(如果 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号