In your session NLS_DATE_FORMAT is set to DD-MON-RR.
Which two queries display the year as four digits? (Choose two.)
In your session NLS_DATE_FORMAT is set to DD-MON-RR.
Which two queries display the year as four digits? (Choose two.)
When looking to display the year as four digits, we need to use the TO_CHAR function with the appropriate date format. For option B, the correct syntax would be SELECT TO_CHAR(SYSDATE, 'MM/DD/YYYY') FROM DUAL; which ensures the year is displayed in four digits. Similarly, in option E, SELECT TO_CHAR(ADD_MONTHS(SYSDATE, 6), 'DD-MON-YYYY') FROM DUAL; also correctly formats the date to display the year in four digits.
Checked it should be B and E
BE is correct
BE is correct
Just need quotes around format string in B
E & B will show year forma in 4 digits only if you consider B has no typing error..the string has to be quoted. SELECT TO_CHAR(SYSDATE, 'MM/DD/YYYY') FROM DUAL; In answer it is written MM/DD/YYYY without quotes.
D have no fm so best is E F
Why F is not correct in my editor it gives a result ? I think the answer is (BEF)
B & E is correct answer. Tested.
BE is correct
B only if you correct it SELECT TO_CHAR(SYSDATE, 'MM/DD/YYYY') FROM DUAL; and E
B and e
sorry i am kind of confused...why do they have to be converted to character?
Weird. Imported all in to Oracle apex and got the following results: SELECT TO_DATE(SYSDATE, 'RRRR-MM-DD') FROM DUAL; ---- ORA-01843: not a valid month SELECT TO_CHAR(SYSDATE, MM/DD/YYYY) FROM DUAL; ----- Error at line 1/31: ORA-00904: "YYYY": invalid identifier. This answer is missing single quotes around the format, otherwise it would be correct. SELECT TO_DATE(ADD_MONTHS(SYSDATE, 6), 'dd-mon-yyyy') FROM DUAL; ------ ORA-01843: not a valid month SELECT TO_CHAR(ADD_MONTHS(SYSDATE, 6)) FROM DUAL; ------ 09/15/2023 and thus is correct. SELECT TO_CHAR(ADD_MONTHS(SYSDATE, 6), 'dd-mon-yyyy') FROM DUAL; ------ 15-sep-2023 and thus is also correct. SELECT TO_DATE(TO_CHAR(SYSDATE, 'MM/DD/YYYY'), 'MM/DD/YYYY') FROM DUAL; ------- 03/15/2023 and thus is also correct?| This question is just a mess...
Im guessing there's a typo in B, u probably missed: "In your session NLS_DATE_FORMAT is set to DD-MON-RR."
D have no fm so best is E F
BE is correct