1z0-071 Exam QuestionsBrowse all questions from this exam

1z0-071 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.)

Show Answer
Correct Answer: BCE

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

14 comments
Sign in to comment
Babi265Options: BE
Dec 6, 2022

Checked it should be B and E

cadcadleyOptions: BE
Jan 11, 2023

BE is correct

jfc1Options: BE
Jan 27, 2023

BE is correct

jm9999Options: BE
Sep 21, 2023

Just need quotes around format string in B

kesammy9Options: BE
Feb 23, 2023

BE is correct

Rik92Options: DE
Mar 15, 2023

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
Jan 3, 2024

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

ogi33
Apr 8, 2024

D have no fm so best is E F

MooonLight
Apr 23, 2023

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

Cecilia_SosoOptions: BE
Apr 29, 2023

B and e

zouveOptions: BE
Jun 25, 2023

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

lucemqyOptions: BE
Nov 16, 2023

BE is correct

deepzsivaOptions: BE
Jan 18, 2024

B & E is correct answer. Tested.

hmatinnnOptions: EF
Feb 24, 2024

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

ogi33Options: EF
Apr 8, 2024

D have no fm so best is E F

ArslanAltafOptions: BE
Jun 7, 2024

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.