exam questions

Exam 1z0-082 All Questions

View all questions & answers for the 1z0-082 exam

Exam 1z0-082 topic 1 question 41 discussion

Actual exam question from Oracle's 1z0-082
Question #: 41
Topic #: 1
[All 1z0-082 Questions]

The EMPLOYEES table contains columns EMP_ID of data type NUMBER and HIRE_DATE of data type DATE.
You want to display the date of the first Monday after the completion of six months since hiring.
The NLS_TERRITORY parameter is set to AMERICA in the session and, therefore, Sunday is the first day on the week.
Which query can be used?

  • A. SELECT emp_id, ADD_MONTHS(hire_date, 6), NEXT_DAY('MONDAY') FROM employees;
  • B. SELECT emp_id, NEXT_DAY(ADD_MONTHS(hire_date, 6), 'MONDAY') FROM employees;
  • C. SELECT emp_id, NEXT_DAY(MONTHS_BETWEEN(hire_date, SYSDATE), 6) FROM employees;
  • D. SELECT emp_id, NEXT_DAY(ADD_MONTHS(hire_date, 6), 1) FROM employees;
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ama
Highly Voted 3 years, 6 months ago
I double checked this Question, B is correct ! the Setting of NLS_TERRITORY changed the behavior
upvoted 16 times
Ekos
3 years, 1 month ago
i agree
upvoted 1 times
...
...
saif_alrwiliy
Highly Voted 3 years, 4 months ago
"The NLS_TERRITORY parameter is set to AMERICA in the session and, therefore, Sunday is the first day of the week." 1 is Sunday in that case. Correct answer is B.
upvoted 10 times
...
nautil2
Most Recent 3 months ago
Selected Answer: B
A - false; query returns emp_id and two dates where any of those dates does not meet required conditions B - true; 6 months are added to hire_date properly with ADD_MONTHS, then first monday following the date is found with NEXT_DAY function C - false; function MONTHS_BETWEEN returns the number of months, which is a NUMBER value. This number is then first argument of NEXT_DAY which accepts DATE value as its first parameter. Therefore an error "ORA-00932: inconsistent datatypes: expected DATE got NUMBER" occurs. D - false; it’s very similar to B and almost correct/true. Key information is NLS_TERRITORY=AMERICA : number 1 as a week day number links to Sunday. If NLS_TERRITORY was set to some European country, number 1 would link to Monday and both queries (B, D) would return the same results.
upvoted 1 times
...
raferen10
1 year, 1 month ago
Selected Answer: B
B is correct
upvoted 1 times
...
Tony1122
1 year, 5 months ago
what is "˜MONDAY' ? but not 'MONDAY' is it my browser problem?
upvoted 1 times
...
AnnWang
1 year, 5 months ago
B is correct
upvoted 2 times
...
Franky_T
1 year, 8 months ago
Selected Answer: B
A is wrong. The NEXT_DAY function needs 2 arguments to work. NEXT_DAY returns the date of the first weekday named by char that is later than the date date. B is correct. First we add 6 months to the hire date using the ADD_MONTHS function, then passing that date value to the NEXT_DAY function. C is wrong. Issues with both the MONTHS_BETWEEN function (wrong usage and argument order) and the NEXT_DAY function (second argument should be a day name). D is wrong. Not because of the usage but because of the Day returned. Using a "1" as the second argument in the NEXT_DAY function it returns a Sunday date and not the first Monday. Looking at the official Oracle documentation the second argument should be character (day name) only. "The argument char must be a day of the week in the date language of your session, either the full name or the abbreviation." Just goes to show that 1, Oracle documentation is never 100% complete and 2, test test test if you are not sure.
upvoted 2 times
...
ryuah
2 years ago
B is correct
upvoted 1 times
...
mianjee
2 years, 4 months ago
ALTER SESSION SET NLS_TERRITORY = "AMERICA"; SELECT employee_id, NEXT_DAY(ADD_MONTHS(hire_date, 6), 'MONDAY') FROM employees; Result = 22-DEC-03 (Monday) SELECT employee_id, NEXT_DAY(ADD_MONTHS(hire_date, 6), 1) FROM employees; Result = 21-DEC-03 (Sunday) Correct answer is B!
upvoted 1 times
...
you1234
3 years, 6 months ago
D is correct
upvoted 1 times
...
ama
3 years, 6 months ago
Today is 24.06.2020... SQL> alter session set nls_date_format='DD.MM.YYYY'; Session wurde geandert. SQL> SQL> SQL> select sysdate, NEXT_DAY(ADD_MONTHS(sysdate, 6), 1) from dual; SYSDATE NEXT_DAY(A ---------- ---------- 24.06.2020 28.12.2020 The first Monday after six months is 28.12.2020 > so correct answer must be D
upvoted 2 times
SimoneF
3 years, 1 month ago
But if your NLS_TERRITORY is 'AMERICA' and your week starts with sunday, it will give you the wrong result. For me, this works until i leave the territory as ITALY but, when I set it to AMERICA like the question states, it's wrong while 'MONDAY' works.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago