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

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


相关文档:

ARCSDE for Oracle 数据存储形式为st_geometry

SELECT sde.st_area(zone) from sde.test1 ORDER BY name;//
SELECT shape from schools ORDER BY name;
SELECT objectid, sde.st_astext(SDE.ST_POINTfromSHAPE(shape,0)) AS points from schools;
SELECT name, sde.st_x (zone) "The X coordinate" from test ; //正确执行
SELECT name, sde.st_x (shape)  "The ......

oracle DBTIMEZONE时区调整

select dbtimezone from dual ;  --查看数据库时区
select sessiontimezone from dual ;  --查看会话时区
1.select u.name || '.' || o.name || '.' || c.name TSLTZcolumn
       from sys.obj$ o, sys.col$ c, sys.user$ u
      &nbs ......

玩转Oracle(4)

//使用自定义函数定义日期格式
to_date('1982-11-11','yyyy-mm-dd')
to_date('1982/11/11','yyyy/mm/dd')
//希望员工scott的岗位,工资,补助与smith员工一样
update emp set (job,sal,comm)=(select job,sal,comm from emp where ename='SMITH') where ename='SCOTT';
||-------  java使用oracle &nbs ......

oracle keep(first/last)


 先看一段ORACLE官方文档
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/analysis.htm#25806:
FIRST/LAST Functions
The FIRST/LAST aggregate functions allow you to return the result of an aggregate applied over a set of rows that rank as the first or last with respect to a ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号