Active1 year, 1 month ago
In SQL Server we can type
IsNull()
to determine if a field is null. Is there an equivalent function in PL/SQL?What is PL/SQL? PL/SQL stands for Procedural Language extension of SQL. PL/SQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle Corporation in the early 90’s to enhance the capabilities of SQL. Oracle® SQL Developer User's Guide Release 1.5 E12152-07 August 2013 Provides conceptual and usage information about Oracle SQL Developer, a graphical tool that enables you to browse.
![Sql Sql](/uploads/1/2/5/6/125681019/399537676.jpg)
Goran
Goran![Oracle Oracle](http://3.bp.blogspot.com/-OH9qzzusS8I/VAR8RPEfcOI/AAAAAAAAAnA/fu0oqSvhWFA/s1600/Sem%2Bt%C3%ADtulo.jpg)
69533 gold badges77 silver badges1111 bronze badges
4 Answers
coalesce
is supported in both Oracle and SQL Server and serves essentially the same function as nvl
and isnull
. (There are some important differences, coalesce
can take an arbitrary number of arguments, and returns the first non-null one. The return type for isnull
matches the type of the first argument, that is not true for coalesce
, at least on SQL Server.)15k33 gold badges3838 silver badges6262 bronze badges
BoltClock♦BoltClock550k133133 gold badges12051205 silver badges12311231 bronze badges
Also use
NVL2
as below if you want to return other value from the field_to_check
:Usage: ORACLE/PLSQL: NVL2 FUNCTION
MinhDMinhD
You can use the condition
FrustratedWithFormsDesignerFrustratedWithFormsDesignerif x is not null then...
. It's not a function. There's also the NVL()
function, a good example of usage here: NVL function ref.21.4k2828 gold badges119119 silver badges177177 bronze badges