Oracle中to_number()函数的学习
Oracle中to_number()函数的学习
Oracle中to_number()函数的学习
1、
Converts a string to the NUMBER data type(将字符串转换为数字数据类型) TO_NUMBER(<value>[, <format>, <NLS parameter>]) RETURN NUMBER select to_number('00001228') from dual; to_number('00001228') 1228 select trunc(to_number('123.123'),2) from dual;
结果为:123.12
2、
Converts a HEX number to FLOAT(转换一个十六进制数的浮标) TO_NUMBER(<value>, <format>); SELECT TO_NUMBER('0A', 'XX') FROM dual;
结果为:10
3、
Converts a HEX number to DECIMAL(一个十六进制数转换为十进制) TO_NUMBER(<binary_float | binary_double | number>, '<hex mask>') RETURN <binary_float | binary_double | number>; SELECT TO_NUMBER(100000,'XXXXXXXX') FROM dual;
结果为:1048576