I have a table Application which has a column
BORROWINGTERM NUMBER(10,0) Nullable
why this script throw an error (ORA-01722 invalid number)
select nvl(borrowingterm, 'no term') from Application
while this one works
select nvl(to_char(borrowingterm), 'no term') from Application
and this one also works
select nvl(1234,5678) from dual;
base on this article
the first parameter of NVL function should be string type
You're getting the error because you are mixing two different types in the nvl clause. One number, one string. The types must be the same.
Keeping it simple ,
Example:
select nvl(to_char(borrowingterm), 'no term') from Application;
//conert number to string and then provide string substitute value to column
select nvl(borrowingterm, 0') from Application;
// replacing null with 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With