Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 1z0-071 topic 1 question 65 discussion

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

Which two are true about the NVL, NVL2, and COALESCE functions? (Choose two.)

  • A. NVL must have expressions of the same data type.
  • B. NVL can have any number of expressions in the list.
  • C. NVL2 can have any number of expressions in the list.
  • D. COALESCE stops evaluating the list of expressions when it finds the first non-null value.
  • E. The first expression in NVL2 is never returned.
  • F. COALESCE stops evaluating the list of expressions when it finds the first null value.
Show Suggested Answer Hide Answer
Suggested Answer: DE 🗳️
Reference:
https://www.interviewsansar.com/difference-between-nvl-nvl2-nullif-and-coalesce-functions/

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
ArslanAltaf
2 weeks ago
A is not necessarily be true. DB applies implicit conversation which sometimes will not work. https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/NVL.html
upvoted 1 times
...
lucemqy
5 months, 2 weeks ago
Selected Answer: DE
First expression of NVL2 is never returned, it's only used for evaluation.
upvoted 2 times
...
HassanMkhlalati
5 months, 4 weeks ago
Selected Answer: DE
A: NVL, does implicit conversion. Could have expressions of different datatype
upvoted 3 times
...
Sangiii
8 months, 1 week ago
A: NVL must have expressions of same datatype my inputs- here in option used must have hence it is not right SELECT NVL(ENAME, 0) FROM EMP; -- Here Ename is Varchar2 and we are passing 0 Number data type as second parameter. In this scenario, NVL working for 2 different datatypes.
upvoted 1 times
HassanMkhlalati
5 months, 4 weeks ago
Implicit conversion is always successful from number to varchar, not the opposite.
upvoted 1 times
...
...
DE is correct the data types of the nvl are possible to explicitly convert the data type
upvoted 2 times
...
anushamathew12071997
9 months, 1 week ago
D IS CORRECT COALESCE () BEACUSE Return first not null expression in the expression list.
upvoted 1 times
...
anushamathew12071997
9 months, 1 week ago
E IS CORRECT The first expression in NVL2 is never returned, it is only used to determine whether expression2 must be returned, or expression3.
upvoted 1 times
...
zouve
10 months, 1 week ago
Selected Answer: AD
E is not right because NVL2 (expr1, expr2, expr3) expr1 is the source value or expression that may contain null expr2 is the value returned if expr1 is not null expr3 is the value returned if expr1 is null F is not right because The COALESCE() function returns the first non-null value in a list.
upvoted 1 times
...
ESZ
11 months ago
Selected Answer: AD
AD is correct, if not then please correct me.
upvoted 1 times
...
CMjer
11 months, 3 weeks ago
Selected Answer: DE
DE is correct: D. COALESCE stops evaluating the list of expressions when it finds the first non-null value. TRUE https://www.oracletutorial.com/oracle-comparison-functions/oracle-coalesce/ E. The first expression in NVL2 is never returned. TRUE If expr1 is not null, then NVL2 returns expr2. If expr1 is null, then NVL2 returns expr3. (https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/NVL2.html)
upvoted 2 times
...
ESZ
1 year ago
Selected Answer: AD
A, D is correct
upvoted 1 times
...
Eltelwany
1 year, 1 month ago
It should be AD. A: it is true that oracle can make implicit conversions but still the NVL function requires that the two exps be of the same data type. Hence A is correct E is wrong because if we specified that we want the same exp to be returned when it's not null it would return its first exp. Tried this in Toad and got 'h1' select nvl2('h1', 'h1', 4) from dual;
upvoted 2 times
CyberP
11 months, 1 week ago
nvl2(expression1,expression2,expression3) so even expression2 = expression1 we will not say expression1 is returned A: we can implicitly use different type of data with nvl select nvl(1,'1') from dual; it will work so A is incorrect D,E is correct.
upvoted 3 times
...
...
lorenzo87
1 year, 3 months ago
it's also true the A, select nvl(1,'pippo') from dual returns ora-01722
upvoted 1 times
MorticiaAAddams
1 year, 3 months ago
Yes, but some values can be impicit converted into anotherdata type like nvl(1,'1').
upvoted 3 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 ...