oracle中to_char方法怎么用
1)用作日期转换:
to_char(date,'格式');示例如下:
select to_date('2005-01-01 ','yyyy-MM-dd') from dual;select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') from dual;2)处理数字:
to_char(number,'格式');示例如下:
select to_char(88877) from dual;select to_char(1234567890,'099999999999999') from dual;select to_char(12345678,'999,999,999,999') from dual;select to_char(123456,'99.999') from dual;select to_char(1234567890,'999,999,999,999.9999') from dual;3)TO_CHAR 是把xxx转换为字符串,不能指定字符串长度。
TO_CHAR(xxx) 例如:TO_CHAR(999) 得到字符串999扩展知识:
to_char(salary,'$99,99');select TO_CHAR(123,'$99,999.9') from dual;用于进制转换:将10进制转换为16进制;select to_char(4567,'xxxx') from dual;select to_char(123,'xxx') from dual; | 留言与评论(共有 0 条评论) “” |