代码改变世界

12c OCP考试专项 [1z0-071]-Q4:TO_CHAR/TO_DATE(2020.06.14)

2020-06-14 23:06  askscuti  阅读(235)  评论(0编辑  收藏  举报

which two statements are true?

A. SELECT TO_DATE('2019-DEC-25 15:30','YYYY-MM-DD HH24:MI','NLS_DATE_LANGUAGE=AMERICAN') FROM DUAL;
B. SELECT TO_CHAR('2019-DEC-25 03:30','YYYY-MM-DD HH24:MI') FROM DUAL;
C. SELECT TO_CHAR(TO_DATE('2019-DEC-25 03:30','YYYY-MON-DD HH12:MI')) FROM DUAL;
D. SELECT TO_CHAR('2019-DEC-25 15:30','YYYY-MM-DD HH24:MI','NLS_DATE_LANGUAGE=AMERICAN') FROM DUAL;
E. SELECT TO_DATE(TO_CHAR('2019-DEC-25 03:30','YYYY-MON-DD HH12:MI')) FROM DUAL;

Answer: AC

Explanation:
TO_CHAR 函数括号内第一个值必须为日期型处理字段,不能为字符;为字符型日期格式的全部语法错误,直接排除 BDE

执行结果如下:

A. 2019-12-25 15:30:00
B. ORA-01722: invalid number
C. 2019-12-25 03:30:00
D. ORA-01722: invalid number
E. ORA-01722: invalid number

提示:答案为个人理解和解答,难免有错,也欢迎大家及时指正。