How to determine NULL in SQL Server, Oracle, and MySQL

Source: Internet
Author: User

This article describes how to replace NULL values in SQL Server, Oracle, and MySQL.
In SQL Server Oracle MySQL What should I do if I find a NULL value in the database?
1. MSSQL: ISNULL ()
Syntax
Java code
Copy codeThe Code is as follows:
ISNULL (check_expression, replacement_value)
ISNULL (check_expression, replacement_value)

Parameters
Check_expression
Whether the expression is NULL is checked. Check_expression can be of any type.
Replacement_value
The expression returned when check_expression is NULL. Replacement_value must be of the same type as check_expresssion.
Return type
Returns the same type as check_expression.
Note
If check_expression is not NULL, the value of this expression is returned; otherwise, the value of replacement_value is returned.
2. Oracle: NVL ()
Syntax
Java code
Copy codeThe Code is as follows:
NVL (eExpression1, eExpression2)
NVL (eExpression1, eExpression2)

Parameters
EExpression1, eExpression2
If the calculation result of eExpression1 is null, NVL () returns eExpression2. If the calculation result of eExpression1 is not null, eExpression1 is returned. EExpression1 and eExpression2 can be any data type. If both eExpression1 and eExpression2 are null values, NVL () returns NULL.
Return Value Type
Numeric, currency, logical, or null
Description
If null or null values are not supported, you can use NVL () to remove null values in the calculation or operation.
3. Mysql: IFNULL ()
Syntax
Java code
Copy codeThe Code is as follows:
IFNULL (expr1, expr2)
IFNULL (expr1, expr2)

Parameters
Expr1, expr2
If expr1 is not NULL, IFNULL () returns expr1; otherwise, expr2 is returned. IFNULL () returns a number or string value, depending on the context in which it is used

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.