首页 > 代码库 > Oracle SQL: TO_CHAR and TO_NUMBER 笔记
Oracle SQL: TO_CHAR and TO_NUMBER 笔记
(1)
select TO_CHAR(123.56,‘999.9‘) from dual; will return 123.6
select TO_NUMBER(‘123.56‘,‘999.9‘) from dual; will fail because of error "ORA-01722: invalid number"
(2)
select TO_CHAR(123.56,‘999‘) from dual; will return 124
select TO_NUMBER(123.56,‘999‘) from dual; will fail because of error "ORA-01722: invalid number"
(3)
select TO_CHAR(123.56,‘9999.99‘) from dual;will return 123.56
select TO_NUMBER(‘123.56‘,‘9999.99‘) from dual; will return 123.56
(4)
select TO_CHAR(123.56,‘9999‘) from dual; will return 124
select TO_NUMBER(‘123.56‘,‘9999‘) from dual; will fail because of error "ORA-01722: invalid number"
(5)
select TO_CHAR(123.56,‘99‘) from dual; will return ###
select TO_NUMBER(123.56,‘99‘) from dual; will fail because of error "ORA-01722: invalid number"
(6)
select TO_CHAR(123.56,‘999.99‘) from dual; will return 123.56
select TO_NUMBER(123.56,‘999.99‘) from dual; will return 123.56
select TO_CHAR(123.56,‘999.9‘) from dual; will return 123.6
select TO_NUMBER(‘123.56‘,‘999.9‘) from dual; will fail because of error "ORA-01722: invalid number"
(2)
select TO_CHAR(123.56,‘999‘) from dual; will return 124
select TO_NUMBER(123.56,‘999‘) from dual; will fail because of error "ORA-01722: invalid number"
(3)
select TO_CHAR(123.56,‘9999.99‘) from dual;will return 123.56
select TO_NUMBER(‘123.56‘,‘9999.99‘) from dual; will return 123.56
(4)
select TO_CHAR(123.56,‘9999‘) from dual; will return 124
select TO_NUMBER(‘123.56‘,‘9999‘) from dual; will fail because of error "ORA-01722: invalid number"
(5)
select TO_CHAR(123.56,‘99‘) from dual; will return ###
select TO_NUMBER(123.56,‘99‘) from dual; will fail because of error "ORA-01722: invalid number"
(6)
select TO_CHAR(123.56,‘999.99‘) from dual; will return 123.56
select TO_NUMBER(123.56,‘999.99‘) from dual; will return 123.56
Oracle SQL: TO_CHAR and TO_NUMBER 笔记
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。