oracle to_char 转换其他类型为字符串

转换数值为字符串

SELECT TO_CHAR(120,'9999') as A ,TO_CHAR(0.96,'9.99') as B,TO_CHAR(0.96,'0.99') AS C FROM DUAL

image.png

知识点

当使用9来代表数值位时,数值参数中某位为0,则会忽略此位上的数据。此时,应该使用0来代替9

SELECT TO_CHAR(5555.555,'999,999,999.999') as A ,TO_CHAR(5555.555,'$999,999,999.999') as B,TO_CHAR(5555.555,'U999,999,999.999') AS C FROM DUAL

image.png

SELECT TO_CHAR(SYSDATE,'yyyy-mm-dd hh:mm:ss') as t FROM dual

image.png

你可能感兴趣的:(oracle to_char 转换其他类型为字符串)