Which SQL statement would give the required result?

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?

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

Explanation:



Leave a Reply 13

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


deivsto

deivsto

I mean that C is correct answer
SQL> select sysdate from dual;

SYSDATE
———-
2015-06-28

SQL> SELECT TO_CHAR(TO_DATE(‘2007-oct-11’), ‘fmDdthsp “of” Month, Year’) FROM DUAL;

TO_CHAR(TO_DATE(‘2007-OCT-11′),’FMDDTHSP”OF”MONTH,YEAR’)
——————————————————————————–
Eleventh of October, Two Thousand Seven

Marcelo

Marcelo

Two answer are correct.
_______________________________________

A and C

SQL> select to_char(sysdate, ‘fmDdspth “of” Month, Year’) from dual;

TO_CHAR(SYSDATE,’FMDDSPTH”OF”MONTH,YEAR’)
———————————————————————–
Twenty-Eighth of Junho, Twenty Fifteen

_______________________________________________________________________
SQL> select to_char(to_date(sysdate), ‘fmDdthsp “of” Month, Year’) from dual;

TO_CHAR(TO_DATE(SYSDATE),’FMDDTHSP”OF”MONTH,YEAR’)
———————————————————————–
Twenty-Eighth of Junho, Twenty Fifteen

Ser

Ser

Option A works with date value, if you try this an error was raised:

SELECT TO_CHAR(’11-oct-2007′, ‘fmDdspth “of” Month, Year’) FROM DUAL;

ORA-01722: invalid number
01722. 00000 – “invalid number”
*Cause: The specified number was invalid.
*Action: Specify a valid number.

So, the correct answer is C

Sayed

Sayed

Yes C is the only right answer. In case of A we should convert string to date format. SYSDATE is by default in date format.

Oualid AIT WAFL

Oualid AIT WAFL

it depends on your NLS_DATE_FORMAT

ash

ash

A is wrong. Still get error with proper nls_date_format:

SQL>alter session set nls_date_format =’DD-MON-YYYY’;

Session altered.

SQL>select to_char(’11-OCT-2016′,’fmDdspth “of Month, Year’) from dual;

select to_char(’11-OCT-2011′,’fmDdspth “of Month, Year’) from dual
*
ERROR at line 1:
ORA-01722: invalid number

shine

shine

What does fmDdspth stand for?

Fredy

Fredy

It represents the day in words Eleventh

Dd Is for day in this case 11. If you add sp then the result is Eleven because Dd has a Capital letter, th is added at the end and fm is for eliminate the blank spaces.

Sorry for my broken english.

I’m preparing this exam too

email: [email protected]

tony teo

tony teo

C is correct

The Tuk

The Tuk

C only is correct.

โชคดี!!!

bhavesh

bhavesh

none of the options is executing for me