oracle cast() 函数问题
关键字: oracle cast() 函数问题
SQL> create table t1(a varchar(10));
Table created.
SQL> insert into t1 values ('12.3456');
1 row created.
SQL> select round(a) from t1;
ROUND(A)
----------
12
SQL> select round(a,3) from t1;
ROUND(A,3)
----------
12.346
SQL> select cast(a as int) from t1;
CAST(AASINT)
------------
12
SQL> select cast(a as number(8,4)) from t1;
CAST(AASNUMBER(8,4))
--------------------
12.3456
=========================================================
cast 是进行类型转换的, 可以针对各种Oracle数据类型. 修改的是用户的数据类型.
round只是修改的数据显示格式. 对数据做四舍五入. 类似的函数还有ceil(取此数据的最小整数). trunc( 取整函数.)
复制内容到剪贴板
代码:
SQL> select round(12.45) round,trunc(12.45) trunc,ceil(12.45) ceil
2 from dual
3 /
ROUND TRUNC CEIL
---------- ---------- ----------
12 12 13
SQL> select round(12.54) round,trunc(12.54) trnc,ceil(12.54) ceil
2 from dual
3 /
ROUND TRNC CEIL
---------- ---------- ----------
13 12 13
SQL>
相关文档:
Lately,
Jordan bank upgraded their ICBS banking software to Oracle 9i and
IDS9i. The Bank also moved from a decentralized to a centralized
system.
We were contracted to monitor and diagnose performance issues during the launching phase of the new system.
The IBM server was equipped with 32 GB o ......
事关CUBE ROLLUP GROUPING SETS(1)
原文引自: 聚合是数据仓库的基础。为了提高聚合的性能。Oracle提供了Group By 条款的扩展。
1. CUBE, ROLLUP扩展
2. 3个grouping函数
3. Grouping set扩展
CUBE ROLLUP ......
总结了一下删除重复记录的方法,以及每种方法的优缺点。
假设表名为Tbl,表中有三列col1,col2,col3,其中col1,col2是主键,并且,col1,col2上加了索引。
1、通过创建临时表
可以把数据先导入到一个临时表中,然后删除原表的数据,再把数据导回原表,SQL语句如下:
creat table tbl_tmp (select distinct* from tb ......