oracle PL/SQL 中的最小函数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5630264/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 23:19:09  来源:igfitidea点击:

min function in PL/SQL

sqloracleplsql

提问by Gary Li

I want to choose the min value in two date ,such as

我想选择两个日期的最小值,例如

c := min(a,b);

It occupy compiler error :

它占用编译器错误:

Error(20,10): PLS-00103: Encountered the symbol "," when expecting one of the following:
. ( ) * @ % & - + / at mod remainder rem || multiset

误差(20,10):PLS-00103:出现符号“”在需要下列之一时:
。( ) * @ % & - + / at mod 余数 rem || 多集

I know we can use aggregate function Minin the SQL. I dan't whether there is the similar func i can use i pl/sql?

我知道我们可以Min在 SQL 中使用聚合函数 。我不知道是否有类似的功能我可以使用我的 pl/sql?

回答by Paul Hanbury

In PLSQL, the leastfunction returns the smallest value in a list of expressions.

在 PLSQL 中,该least函数返回表达式列表中的最小值。

回答by reza

LEAST("ColumnName", _NumberOfRows)

LEAST("ColumnName", _NumberOfRows)

Example: For the Minimum 5 Rows = LEAST(Price,5)

示例:对于最少 5 行 = LEAST(Price,5)