trunc 将实数的小数部分舍去使之成为一个整数
nvl 不知道
nvl 不知道
解决方案 »
- 用一个数据库去连接另外一个数据库
- ora-01652 无法通过128(在表空间TEMP中)扩展temp段
- 我用update更新一表,怎么将更新的表中几个字段同时搬入另一表
- 请问谁有10g的init*.ora文件?我的老是报错,不知道是什么原因。我的系统是rhas3
- oracle8倍份的奇怪问题!
- ORA-01033: ORACLE initialization or shutdown in progress在9i下的解决方案
- 新手请教关于游标的问题!~
- 关于包中的全局变量
- 新手提问
- 在Delphi中使用Oracle存储过程是否必须用procedure控件?不能在query中执行?
- ora8i的安装问题,急!
- 有没有顶级高手,解决一下long字段的查询问题!
select trunc(59.232) from dual;返回:59nvl()是如果值为null时的缺省值,如
select nvl(field, 0) from table;如果field为空,则返回0
-------------
123SQL> select nvl(null,'一个空值') from dual;NVL(NULL,'一个空值')
--------------------
一个空值trunc--取整函数
nvl --操作数1为空,那就取第二个值,反之,显示操作数1
1.截位数字
2.截位日期
实例如下:
1.
SELECT TRUNC(15.79,1) FROM DUAL;TRUNC(15.79,1)
----------
15.7SELECT TRUNC(15.79,-1) FROM DUAL;TRUNC(15.79,-1)
----------
10
2.
SELECT TRUNC(TO_DATE('27-OCT-92','DD-MON-YY'), 'YEAR') "New Year" FROM DUAL;
New Year
---------
01-JAN-92 给出截日期的格式:
Date Format Models for the ROUND and TRUNC Date Functions
Format Model Rounding or Truncating Unit
CC One greater than the first two digits of a four-digit year.
SCC
SYYYY Year (rounds up on July 1)
YYYY
YEAR
SYEAR
YYY
YY
YIYYY ISO Year
IY
IY
IQ Quarter (rounds up on the sixteenth day of the second month of the quarter) MONTH Month (rounds up on the sixteenth day)
MON
MM
RM
WW Same day of the week as the first day of the year. IW Same day of the week as the first day of the ISO year. W Same day of the week as the first day of the month. DDD Day
DD
JDAY Starting day of the week
DY
D
HH Hour
HH12
HH24MI Minute