【ocp-12c】最新Oracle OCP-071考试题库(47题)

前端之家收集整理的这篇文章主要介绍了【ocp-12c】最新Oracle OCP-071考试题库(47题)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

47、(10-6)choose two

You need to calculate the number of days from 1st January 2007 till date.

Dates are stored in the default format of dd-mon-rr.

Which two sql statements would give the required output?

A) SELECT TO_DATE (SYSDATE,‘DD/MONTH/YYYY‘) - ‘01/JANUARY/2007‘ FROM DUAL;

B) SELECT SYSDATE - TO_DATE (‘01/JANUARY/2007‘) FROM DUAL;

C) SELECT SYSDATE -‘01-JAN-2007‘ FROM DUAL;

D) SELECT SYSDATE - TO_DATE (‘01-JANUARY-2007‘) FROM DUAL;

E) SELECT TO_CHAR (SYSDATE,‘DD-MOM-YYYY‘) - ‘01-JAN-2007‘ FROM DUAL;

Answer:BD

(解析:对数据进行混合运算时必须要用转换函数转换为日期格式,因为它不会隐式转换,但是我们在insert

数据时,会实现隐式转换。

sql> SELECT SYSDATE - TO_DATE (‘01-1 月-2007‘) FROM DUAL;

或者:

sql> SELECT SYSDATE - TO_DATE (‘01/1 月/2007‘) FROM DUAL;

 

)

猜你在找的Oracle相关文章