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 Oracle comparison functions GREATEST and LEAST use

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions069.htm#i77473

Http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions087.htm#i77700

These two functions are a pair of opposite functions, and the syntax is:

They all determine the data type of the return value by the character type of the first expr. If the first expression is numeric, the function implicitly converts the subsequent expression to a numeric type according to the principle of numerical priority.

Example:

SQL > select least ('china','england','american','russia') country from dual;COUNTRY----american SQL > select greatest (' china','england','american','russia') country from dual;COUNTRY-russiaSQL > select least Select least (1) country from dual * ERROR at line 1:ORA-01722: invalid number

An error occurs, indicating that when I specify a numeric type, subsequent expressions are converted to numeric type

SQL > select least (1MIT 3.14159JEL 0.1415926) country from dual; COUNTRY- .1415926SQL > select greatest (1Min 3.14159JEL 0.1415926) country from dual; COUNTRY- 3.14159

SQL > select least ('china','england',2,1) country from dual

COU

-

one

Here you can see that the subsequent values here have been converted to character types.

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