Topic: 1z0-082 topic 1 question 86

You execute this query:
SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd `Monday for` fmMonth rrrr')
What is the result?

A.
It executes successfully but does not return any result
B.
It returns the date for the first Monday of the next month
C.
It generates an error
D.
It returns the date for the last Monday of the current month

Re: 1z0-082 topic 1 question 86

c is correct, because it generates an error, the query does not have the FROM keyword

Re: 1z0-082 topic 1 question 86

ORA-01846: 01846. 00000 -  "not a valid day of the week"

Re: 1z0-082 topic 1 question 86

the correct query is

SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd "Monday for" fmMonth rrrr') FROM DUAL;

I had this question also on the 1Z0-071 exam.

Re: 1z0-082 topic 1 question 86

C is correct since FROM DUAL is missing and ( 'Monday for') should actually be ("Monday for"). Could be an issue where the website didn't post the question correctly. I've seen this question in 071 exam which has the correct format but different answers.

https://www.islever.com/discussions/oracle/view/32798-exam-1z0-071-topic-2-question-17-discussion/

Re: 1z0-082 topic 1 question 86

B is correct.

SQL> SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd "Monday for" fmMonth rrrr') from dual;

TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE),'MON'),'DD"MONDAYFOR"FMMONTHRRRR')
--------------------------------------------------------------------------------
01 Monday for May 2023

Re: 1z0-082 topic 1 question 86

The correc query:

SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd "Monday for" fmMonth rrrr') from dual;

B is right.

Re: 1z0-082 topic 1 question 86

SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd `Monday for` fmMonth rrrr') from dual;
SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd `Monday for` fmMonth rrrr') from dual
                                                   *
ERROR at line 1:
ORA-01821: date format not recognized

Re: 1z0-082 topic 1 question 86

C - it generates an error, even if FROM dual is added.
SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd `Monday for` fmMonth rrrr')
returns ORA-00923: FROM keyword not found where expected
SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd `Monday for` fmMonth rrrr') FROM dual;
returns ORA-01821: date format not recognized

Re: 1z0-082 topic 1 question 86

It was probably a mistake when moving to the website, some characters are wrong. For me, the righ answers is B.

Re: 1z0-082 topic 1 question 86

FROM DUAL; must be added after the query statement
so answer is B

Re: 1z0-082 topic 1 question 86

I think answer should be C. There is no from clause!