Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of Oracle NVL function

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Today, I studied the process in the database and found that NVL is used. My memory is not good. I used it before and forgot it for a long time. So I went to check the official explanation:

http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions119.htm#i91798

NVL belongs to character conversion output is also character type.

The expression is NVL(expr1,expr2)

Its purpose is to convert "empty" characters into "non-empty" characters, when expr1 is empty, output expr2, otherwise output expr1.

Expr1 and expr2 can be of any data type. If the data types of the two are inconsistent, type conversion will be performed.

The principles of its transformation follow:

If expr1 is a character type, convert expr2 to expr1's type before comparing and return the character set as varchar2.

2. If expr1 is a numeric type, Oracle itself will convert the data type to a high-priority data type according to the highest priority judgment.

and ultimately returns data of that type.

Examples:

SELECT NVL(MAX(ID), 0) FROM WAYBILL;

This means that 0 is returned when the largest ID in the WAYBILL table is empty.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report