Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Weird behaviour of LENGTH(NVL())

Hello
I was checking some not working DB code and found out there is a weird behaviour of checking NULL values:
SELECT LENGTH(NVL(NULL, '')) FROM DUAL;
-> Output: nothing (kinda null, expected: 0)
SELECT LENGTH(NVL(NULL, ' ')) FROM DUAL;
-> Output: 1 (what I expected)
Is there an explanation for this?
Experienced in Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

This post has been answered by Solomon Yakobson on Mar 19 2021
Jump to Answer
Comments
Post Details
Added on Mar 19 2021
2 comments
551 views