You need to display the date 11-oct-2007 in words as ‘Eleventh of October, Two Thousand Seven’.
Which SQL statement would give the required result?
A.
SELECT TO_CHAR(’11-oct-2007′, ‘fmDdspth "of" Month, Year’) FROM DUAL;
B.
SELECT TO_CHAR(TO_DATE(’11-oct-2007′), ‘fmDdspth of month, year’) FROM DUAL;
C.
SELECT TO_CHAR(TO_DATE(’11-oct-2007′), ‘fmDdthsp "of" Month, Year’) FROM DUAL;
D.
SELECT TO_DATE(TO_CHAR(’11-oct-2007′,’fmDdspth ”of” Month, Year’)) FROM DUAL;
why isn’t option B correct?
( fmDdspth )
Because the “of” is not quoted and the month and year format are in lowercase
Case makes no difference. Only “of” is needed.
B is not correct because word ‘of’ needs to be betwen double quotas
like in C.
i appreciate your help!
B is not correct also because the “Y” of Year is not capitalized !
We can give small ”y’ also in Year. Thats not an error
SQL> SELECT TO_CHAR(TO_DATE(’11-oct-2007′), ‘fmDdthsp “of” Month, year’) FROM DU
AL;
TO_CHAR(TO_DATE(’11-OCT-2007′),’FMDDTHS
—————————————
Eleventh of October, two thousand seven
C is correct but must have set the NLS_LANGUAGE = English
alter session set NLS_LANGUAGE = ‘ENGLISH’;
TO_CHAR(TO_DATE(’11-OCT-2007′),’FMDDSPTH”OF”MONTH,YEAR’)
———————————————————————–
Eleventh of October, Two Thousand Seven
C. is not correct because ‘fmDdthsp’ isn’t the correct spell. It should be ‘fmddspth’.
C. is correct
SPTH or THSP Spelled, ordinal number
http://docs.oracle.com/cd/B12037_01/server.101/b10759/sql_elements004.htm#BABGDDFB
Why D is not correct?
D is not correct because wrong order of functions TO_CHAR and TO_DATE.
C is correct but it should be like
SELECT TO_CHAR(TO_DATE(’11-oct-2007′), ‘fmDdspth “of” Month, Year’) FROM DUAL;
Nope, the result will be the same.
yes this is correct