©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMariaDB

MariaDB NVL SQL Function - If NULL query in Oracle mode

NVLSyntax:NVL(Expression, Value)
Return value:Depending on the data types used
Synonyms:IFNULL
Function type:NULL function
Function Description

The NVL() function returns "Value" if the value of "Expression" is NULL.

If "Expression" is not NULL, NVL() returns the "Expression".

The return type is the type of "Expression" or "Value", depending on the result of the function.


The feature was introduced starting with MariaDB Version 10.3 for Oracle compatibility.

In MySQL 8.0 this feature is not present.

SQL Examples for the NVL function

 1
 2
 3
 4
 5
 6
 7

SELECT nvl(null'Value');
SELECT nvl('ok''Value');
SELECT nvl(nullif('ok''notok'), 'value');
SELECT nvl(nullif('ok''ok'), 'value');
SELECT nvl(nullif('ok''ok'), null);

nvl(null, 'Value')
varchar(5) BINARY
Value
nvl('ok', 'Value')
varchar(5) BINARY
ok
nvl(nullif('ok', 'notok'), 'value')
varchar(5) BINARY
ok
nvl(nullif('ok', 'ok'), 'value')
varchar(5) BINARY
value
nvl(nullif('ok', 'ok'), null)
varchar(2) BINARY
NULL
The examples were created with the MyWAY SQL manager: Download

How to use the NVL() function in MariaDB databases

The NVL() function in MariaDB can handle NULL values ​​by having the function provide a default or alternate value when a column or expression NULL yields and is useful for calculations, comparisons, or displaying results that use NULL values. The function is equivalent to the IFNULL() function and was introduced in MariaDB for Oracle compatibility.
NEXTVALNOWNULLIFNVLNVL2OCTOCTET_LENGTH

Further MySQL und MariaDB SQL NULL functions

COALESCECOALESCE(%, %)
More about COALESCE Function

IFNULLIFNULL(Expression, Value)
More about IFNULL Function

ISNULLISNULL(Expression)
More about ISNULL Function

NULLIFNULLIF(Expression 1, Expression 2)
More about NULLIF Function

NVL2NVL2(Expression, Value1, Value2)
More about NVL2 Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the NVL SQL function: mariadb.com
Updated: 2023-09-24ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer