1Z0-007 · Question #35
Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?
The correct answer is A. SELECT TO_CHAR(SYSDATE,'yyyy'). Function TO_CHAR(x, y) converts the value x to a character or converts a date to a character string using formatting conventions. Incorrect Answers B: Function TO_DATE(x,[y]) converts the non-date value x to a date using the format specified by C: The DECODE function is used as…
Question
Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?
Options
- ASELECT TO_CHAR(SYSDATE,'yyyy')
- BSELECT TO_DATE(SYSDATE,'yyyy')
- CSELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY')
- DSELECT DECODE(SUBSTR(SYSDATE, 8), 'year')
- ESELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),'yyyy')
How the community answered
(21 responses)- A81% (17)
- B5% (1)
- D10% (2)
- E5% (1)
Explanation
Function TO_CHAR(x, y) converts the value x to a character or converts a date to a character string using formatting conventions. Incorrect Answers B: Function TO_DATE(x,[y]) converts the non-date value x to a date using the format specified by C: The DECODE function is used as substitution of IF-THEN-ELSE PL/SQL construction in SQL queries. The SELECT statement provides incorrect syntax of it because it cannot have only two D: The DECODE function is used as substitution of IF-THEN-ELSE PL/SQL construction in SQL queries. The SELECT statement provides incorrect syntax of it because it cannot have only two E: This statement provide incorrect syntax of TO_CHAR() function: it requires only one parameter, not two.
Topics
Community Discussion
No community discussion yet for this question.