SQL Server, Oracle, and MySQL methods for judging null

Source: Internet
Author: User

SQL Server, Oracle, and MySQL methods for judging null

This article covers SQL Server, Oracle, and MySQL to isolate null replacement values.
What if a value of NULL is found in the SQL Server Oracle mysql database?
1, Mssql:isnull ()
Grammar
Java Code

Copy CodeThe code is as follows:
ISNULL (Check_expression, Replacement_value)
ISNULL (Check_expression, Replacement_value)
Parameters
check_expression
An expression that will be checked for null. Check_expression can be of any type.
Replacement_value
The expression that will be returned when check_expression is null. Replacement_value must have the same type as check_expresssion.
return type
returns the same type as check_expression.
Notes
if Check_expression is not NULL, the value of the expression is returned, otherwise Replacement_value is returned.
2, ORACLE:NVL ()
Grammar
Java Code
Copy CodeThe code is as follows:
NVL (EExpression1, EExpression2)
NVL (EExpression1, EExpression2)
Parameters
EExpression1, EExpression2
if the eExpression1 evaluates to a null value, NVL () returns EEXPRESSION2. If the EExpression1 evaluates to a value other than NULL, the EExpression1 is returned. EExpression1 and EExpression2 can be any data type. NVL () returns null if the result of both EExpression1 and EExpression2 is a null value
return value type
character, date, datetime, numeric, currency, logical, or null values
Description
You can use NVL () to remove null values from a calculation or operation in cases where null values are not supported or if NULL values do not matter.
3, Mysql:ifnull ()
Grammar
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, it returns EXPR2. Ifnull () returns a numeric or string value, depending on the context in which it is used

SQL Server, Oracle, and MySQL methods for judging null

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.