日期:2014-05-16  浏览次数:20494 次

decode和case的参数区别 timestamp date
SELECT DECODE('AA ', 'AA', '=', '!=') FROM DUAL; --varchar2类型存储  decode函数接口为varchar2

SELECT CASE WHEN 'AA ' = 'AA' THEN '=' ELSE '!=' END FROM DUAL;  --char类型存储 自动补齐长度

SELECT DUMP('AA '), DUMP('AA') FROM DUAL;--type 96 为char 字符串常量默认为char

SELECT CASE WHEN CAST('AA ' AS VARCHAR2(3)) = CAST('AA' AS VARCHAR2(3))  
2 THEN '=' ELSE '!=' END FROM DUAL;

SELECT DECODE('AA ', CAST('AA' AS CHAR(3)), '=', '!=') FROM DUAL;

--转自
http://hi.baidu.com/yourwushi/blog/item/48c2b8af429a5dce7dd92a5a.html

select to_char(systimestamp,'yyyy-mm-dd hh24:mi:ssxff') time1 from dual;
select to_timestamp('2003-10-24 10:48:45.656000','yyyy-mm-dd hh24:mi:ssxff') from dual;

select to_char(systimestamp, 'yyyy-mm-dd hh24:mi:ssxff ') from dual
--毫秒显示精度6位,有效位3位
--data类型精确到秒, timestamp精确到毫秒

--转自
http://xdw1626.iteye.com/blog/277331