exam questions

Exam 1z0-082 All Questions

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

Exam 1z0-082 topic 1 question 138 discussion

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

Examine the description of the EMPLOYEES table:



NLS_DATE_FORMAT is set to DD-MON-YY.

Which query requires explicit data type conversion?

  • A. SELECT join_date FROM employees WHERE join_date > '10-02-2018';
  • B. SELECT join_date + '20' FROM employees;
  • C. SELECT salary + '120.50' FROM employees;
  • D. SELECT SUBSTR(join_date, 1, 2) - 10 FROM employees;
  • E. SELECT join_date || ' ' || salary FROM employees;
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
Oracle2020
3 months ago
A is correct
upvoted 2 times
...
psycrotic5
7 months, 1 week ago
what about Option D?: SELECT SUBSTR(join_date, 1, 2) - 10 FROM employees; This query is attempting to perform a substring operation on a DATE type, which is not valid without first converting the date to a string. Oracle does not support taking substrings directly from DATE data types. The date must be converted to a string using TO_CHAR before SUBSTR can be used. Furthermore, subtracting 10 from a substring of a date does not make sense unless the substring represents a number, which is not the case here since join_date is a date and not a string of numbers. Therefore, explicit conversion is necessary, and the query itself is somewhat nonsensical without additional context or correction. This makes Option D the most clearly incorrect and the one that certainly requires explicit data type conversion to even make sense as a SQL statement.
upvoted 2 times
...
nautil2
10 months, 3 weeks ago
Selected Answer: C
AC is correct. A returns: SELECT join_date FROM employees WHERE join_date > '10-02-2018'; SELECT join_date FROM employees WHERE join_date > '10-02-2018' * ERROR at line 1: ORA-01843: not a valid month C returns: SQL> SELECT salary+'120.50' FROM employees; SELECT salary+'120.50' FROM employees * ERROR at line 1: ORA-01722: invalid number
upvoted 1 times
nautil2
10 months, 3 weeks ago
Let me correct my suggestion, please. Only C is correct. Datatype conversion in A does not make the query valid. SQL> SELECT join_date FROM employees WHERE TO_DATE(join_date,'DD-MM-YYYY') > '10-02-2018'; SELECT join_date FROM employees WHERE TO_DATE(join_date,'DD-MM-YYYY') > '10-02-2018' * ERROR at line 1: ORA-01843: not a valid month Only altering session variable NLS_DATE_FORMAT with ALTER SESSION SET nls_date_format='DD-MM-YY'; makes the A query to return valid response. So there´s no datatype conversion, just altering session variable, therefore A is false.
upvoted 1 times
...
...
auwia
1 year ago
Selected Answer: A
Provided answer is wrong! The base! :-) part VIII
upvoted 2 times
...
Pivoine
1 year ago
C tested
upvoted 1 times
...
ivanadj
1 year, 4 months ago
Selected Answer: A
https://www.examtopics.com/discussions/oracle/view/13453-exam-1z0-071-topic-1-question-296-discussion/
upvoted 4 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