Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?

Which SELECT statement should you use to extract the year from the system date and display it
in the format “1998”?

Which SELECT statement should you use to extract the year from the system date and display it
in the format “1998”?

A.
SELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),’yyyy’)
FROM dual;

B.
SELECT DECODE(SUBSTR(SYSDATE, 8), ‘year’)
FROM dual;

C.
SELECT TO_DATE(SYSDATE,’yyyy’)
FROM dual;

D.
SELECT TO_CHAR(SYSDATE,’yyyy’)
FROM dual;

E.
SELECT DECODE(SUBSTR(SYSDATE, 8), ‘YYYY’)
FROM dual;

Explanation:

Function TO_CHAR(x, y) converts the value x to a character or converts a date to a character
string using formatting conventions.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


kishan

kishan

Answer : D