YOU need to display the date ll-oct-2007 in words as ‘Eleventh of October, Two Thousand
Seven’. Which SQL statement would give the required result?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
YOU need to display the date ll-oct-2007 in words as ‘Eleventh of October, Two Thousand
Seven’. Which SQL statement would give the required result?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
C is correct.
SELECT TO_CHAR(TO_DATE(’11-oct-2007′), ‘fmDdthsp “of” Month, year’) from dual
Eleventh of October, two thousand seven
C
A
There will be an implicit data conversion of ’11-oct-2007′ appropriately as well as a need to differentiate between TO_CHAR and TO_DATE in this question deliberately.
TO_CHAR: To convert a datetime to a value of VARCHAR2 data type in the format specified by the date format fmt (i.e., fmDdspth).
TO_DATE: To convert char of a character data type to a value of DATE data type.
fm stands for fill mode.
OPTION A gives an error.
option c executes successfully and provides the required result
C
A gives error
C