Oracle Greatest()函数

简介: GREATEST The GREATEST function returns the largest expression in a list of expressions. All expressions after the first are implicitly converted to the data type of the first expression bef

GREATEST

The GREATEST function returns the largest expression in a list of expressions. All expressions after the first are implicitly converted to the data type of the first expression before the comparison.

To retrieve the smallest expression in a list of expressions, use LEAST.

Return Value

The data type of the first expression.

Syntax

GREATEST (expr [, expr]...)

Arguments

expr

An expression.

Examples

Example 16-3 Finding the Longest Text Expressions

The following statement selects the longest string.

SHOW GREATEST ('Harry', 'Harriot', 'Harold')
Harriot

Example 16-4 Finding the Largest Numerical Expression

The following statement selects the number with the greatest value.

SHOW GREATEST (5, 3, 18)
18
原文地址:点击打开链接
相关文章
|
8月前
|
SQL 存储 Oracle
【YashanDB知识库】Oracle pipelined函数在YashanDB中的改写
【YashanDB知识库】Oracle pipelined函数在YashanDB中的改写
|
SQL Oracle 算法
|
SQL Oracle 关系型数据库
|
SQL Oracle 关系型数据库
Oracle|内置函数之INSTR
【7月更文挑战第5天】
|
Oracle 关系型数据库 数据挖掘
|
Oracle 关系型数据库 数据挖掘
|
NoSQL Oracle 关系型数据库
MongoDB与Oracle:管道函数兼容之道
【4月更文挑战第20天】
200 2
|
存储 Oracle NoSQL
Oracle中decode函数详解
Oracle中decode函数详解
|
Oracle 关系型数据库 大数据
oracle递归函数
oracle递归函数
|
存储 SQL Oracle
Oracle创建函数:数据王国的“魔法秘籍”
【4月更文挑战第19天】Oracle函数是数据处理的利器,专注于计算与返回值。通过`CREATE OR REPLACE FUNCTION`定义函数名、参数及返回类型,如示例中的加法函数`add_numbers`。调用函数时,可将其结果赋值给变量。函数可包含复杂逻辑和SQL,与其他数据库对象交互,用于触发器或存储过程。注意函数设计的唯一性、参数类型和性能优化。掌握函数使用能提升代码可读性和数据库管理效率。

推荐镜像

更多