What is the Oracle equivalent of SQL Server's IsNull () function?

In SQL Server, we can enter IsNull() to determine if a field is null. Is there an equivalent function in PL / SQL?

+84
oracle plsql sql-server tsql
Aug 19 '10 at 2:55 a.m.
source share
4 answers

coalesce supported in both Oracle and SQL Server and performs essentially the same function as nvl and isnull . (There are several important differences, coalesce can take any number of arguments and returns the first nonzero. The return type for isnull matches the type of the first argument, which is not true for coalesce , at least on SQL Server.)

+104
Aug 19 '10 at 16:40
source share

Instead of ISNULL() use NVL() .

T-SQL:

 SELECT ISNULL(SomeNullableField, 'If null, this value') FROM SomeTable 

PL / SQL:

 SELECT NVL(SomeNullableField, 'If null, this value') FROM SomeTable 
+84
Aug 19 '10 at 15:00
source share

Also use NVL2 as shown below if you want to return another value from field_to_check :

 NVL2( field_to_check, value_if_NOT_null, value_if_null ) 

Usage: ORACLE / PLSQL: NVL2 FUNCTION

+19
Jun 18 '14 at 9:46
source share

You can use the condition if x is not null then... This is not a function. There's also an NVL() function, a good use case here: the NVL ref function .

+6
Aug 19 '10 at 15:00
source share



All Articles