Exam 1z0-071 All QuestionsBrowse all questions from this exam
Question 137

In your session NLS_DATE_FORMAT is set to DD-MON-RR.

Which two queries display the year as four digits? (Choose two.)

    Correct Answer: B, E

    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.

Discussion
Babi265Options: BE

Checked it should be B and E

jfc1Options: BE

BE is correct

cadcadleyOptions: BE

BE is correct

jm9999Options: BE

Just need quotes around format string in B

ArslanAltafOptions: BE

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.

ogi33Options: EF

D have no fm so best is E F

hmatinnnOptions: EF

Why F is not correct in my editor it gives a result ? I think the answer is (BEF)

deepzsivaOptions: BE

B & E is correct answer. Tested.

lucemqyOptions: BE

BE is correct

zouveOptions: BE

B only if you correct it SELECT TO_CHAR(SYSDATE, 'MM/DD/YYYY') FROM DUAL; and E

Cecilia_SosoOptions: BE

B and e

MooonLight

sorry i am kind of confused...why do they have to be converted to character?

Rik92Options: DE

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...

yanoolthecool

Im guessing there's a typo in B, u probably missed: "In your session NLS_DATE_FORMAT is set to DD-MON-RR."

ogi33

D have no fm so best is E F

kesammy9Options: BE

BE is correct