개인적인 정리

Oracle LEAST() 본문

카테고리 없음

Oracle LEAST()

yeon.Biju 2020. 4. 7. 10:45

오라클 LEAST()

 

LEAST()

   - 여러개의 인자들 사이에서 가장 작은값을 return.

 

LEAST(expr1, expr2....)

의 형태

 

LEAST returns the least of a list of one or more expressions. Oracle Database uses the first expr to determine the return type. If the first expr is numeric, then Oracle determines the argument with the highest numeric precedence, implicitly converts the remaining arguments to that data type before the comparison, and returns that data type. If the first expr is not numeric, then each expr after the first is implicitly converted to the data type of the first expr before the comparison.

 

Oracle Database compares each expr using nonpadded comparison semantics. The comparison is binary by default and is linguistic if the NLS_COMP parameter is set to LINGUISTIC and the NLS_SORT parameter has a setting other than BINARY. Character comparison is based on the numerical codes of the characters in the database character set and is performed on whole strings treated as one sequence of bytes, rather than character by character. If the first expr is a character data type and NVARCHAR2  if the first expr is a national character data type.

 

 

SQL> SELECT LEAST('B','A','C') FROM DUAL;

   --> A

 

SQL> SELECT LEAST(1,'2.1','0.0089') FROM DUAL;

   --> 0.0089

 

SQL> SELECT LEAST(1,'A','B') FROM DUAL;

   --> ORA-01722: invalid number

 

SQL> SELECT LEAST('A','0.1','0.5555') FROM DUAL;

   --> 0.1

 

 

 

 

 

Comments