pl/sql查找表
Given two numbers and we have to find the minimum of 2 numbers in PL/SQL.
给定两个数字,我们必须在PL / SQL中找到至少两个数字。
Syntax:
句法:
Create Procedure Procedure-name
(
Input parameters ,
Output Parameters (If required)
)
As
Begin
Sql statement used in the stored procedure
End
END;
The following procedure in SQL is used to find the minimum of two input numbers.
SQL中的以下过程用于查找至少两个输入数字。
The following lines of SQL code creates a procedure having parameters x, y and z all of them being number type.
下面SQL代码行创建一个过程,该过程的参数x , y和z均为数字类型。
In denotes that the variables are used for taking input while out denotes the output.
In表示变量用于获取输入,而out表示输出。
CREATE OR REPLACE PROCEDURE findMin(x in number,y in number,z out number)
is
begin
if x<y then
z:=x;
else
z:=y;
end if;
end;
Now to run the procedure we use the following piece of code in sql.
现在运行该过程,我们在sql中使用以下代码。
Here a b and c are three number variables which are passed into the findMin function.
这里ab和c是三个数字变量,它们被传递给findMin函数。
code
码
declare
a number;
b number;
c number;
begin
a:=23;
b:=45;
findMin(a,b,c);
dbms_output.put_line('MINIMUM'||c);
end;
Output
输出量
23
翻译自: https://www.includehelp.com/pl-sql/procedure-in-pl-sql-to-find-minimum-of-2-numbers.aspx
pl/sql查找表