DECODE函数的格式为:
DECODE(条件, 值1, 翻译值1, 值2, 翻译值2,……,默认值)
实现的功能为,IF条件=值1 THEN RETURN(翻译值1)
IF条件=值2 THEN RETURN(翻译值2)
………
ELSE RETURN(默认值)
----------------------------------------------------------------------
NVL函数的格式为:
NVL(EXPR1,EXPR2)
若EXPR1是NULL,则返回EXPR2,否则返回EXPR1.
----------------------------------------------------------------------
Substr的格式:
substr('This is a test', 6, 2) would return 'is'
substr('This is a test', 6) would return 'is a test'
----------------------------------------------------------------------
Round 函数 (四舍五入) :
SELECT ROUND( number, [ decimal_places ] ) FROM DUAL
参数:
number : 欲处理之数值
decimal_places : 四舍五入 , 小数取几位 ( 预设为 0 )
----------------------------------------------------------------------
连接两个字符串;
select concat('029-','88888888')||'转11' 电话号码 from dual;
-----------------------------------------------------------------
返回字符串的长度;
select name,length(name),addr,length(addr),sal,length(to_char(sal)) from gao.nchar_tst;
------------------------------------------------------------------
CEIL
返回大于或等于给出数字的最小整数
SQL> select ceil(3.1415927) from dual;
DECODE(条件, 值1, 翻译值1, 值2, 翻译值2,……,默认值)
实现的功能为,IF条件=值1 THEN RETURN(翻译值1)
IF条件=值2 THEN RETURN(翻译值2)
………
ELSE RETURN(默认值)
----------------------------------------------------------------------
NVL函数的格式为:
NVL(EXPR1,EXPR2)
若EXPR1是NULL,则返回EXPR2,否则返回EXPR1.
----------------------------------------------------------------------
Substr的格式:
substr('This is a test', 6, 2) would return 'is'
substr('This is a test', 6) would return 'is a test'
----------------------------------------------------------------------
Round 函数 (四舍五入) :
SELECT ROUND( number, [ decimal_places ] ) FROM DUAL
参数:
number : 欲处理之数值
decimal_places : 四舍五入 , 小数取几位 ( 预设为 0 )
----------------------------------------------------------------------
连接两个字符串;
select concat('029-','88888888')||'转11' 电话号码 from dual;
-----------------------------------------------------------------
返回字符串的长度;
select name,length(name),addr,length(addr),sal,length(to_char(sal)) from gao.nchar_tst;
------------------------------------------------------------------
CEIL
返回大于或等于给出数字的最小整数
SQL> select ceil(3.1415927) from dual;