Oracle转换函数

1--转换函数
--数字转换字符串
select to_char(100)||'' from dual;
select 100||'' from dual;
(2--日期转字符串
select to_char(sysdate,'yyyy-mm-dd') from dual;
select to_char(sysdate,'yyyy')||''||to_char(sysdate,'mm')||''||to_char(sysdate,'dd')||'' from dual;
select to_char(sysdate,'yyyy-mm-dd hh:mi:ss') from dual;
(3--字符串转日期
select to_date('2017-03-10','yyyy-mm-dd') from dual;
(4--字符串转数字
select to_number('100')+10 from dual;
select '100'+0 from dual;
select '100'||0 from dual;--拼接后就变成字符串了

 

posted @ 2018-11-22 22:22  学亮编程手记  阅读(174)  评论(0编辑  收藏  举报