您好,欢迎访问一九零五行业门户网

oracle的存储过程怎么调用

在oracle中,存储过程调用的方法是“declare ... begin 存储过程调用开始按顺序的调用过程 end;”;存储过程包含了过程声明、执行过程部分和存储过程异常三个部分,存储过程可以有无参数过程和带参数存储过程。
本教程操作环境:windows10系统、oracle 12c版、dell g3电脑。
oracle的存储过程怎么调用oracle存储过程包含三部分:过程声明,执行过程部分,存储过程异常。
oracle存储过程可以有无参数存储过程和带参数存储过程。 
oracle存储过程的创建语法
create or replace procedure 存储过程名称(--定义输入、输出参数--参数名1 in 参数类型,参数名2 in 参数类型,参数名3 in 参数类型,参数名4 out 参数类型)as--定义变量----变量名 变量数据类型;如: -- numcount integer; begin --处理方法-end;
上面我们创建一个处理加、减、乘、除计算的函数,那么我们也可以建成存储过程
/******* 创建加、减、乘、除计算的存储过程**输入参数: 数字1,数字2,计算类型**输出参数: 数字3*****/create or replace procedure proc_test(--定义输入、输出参数--num_a in integer,num_b in integer,numtype in integer,num_c out integer)as--定义变量-- -- numcount integer; -- numstr varchar(20); begin --判断计算类型-- if numtype=1 then num_c := num_a + num_b; elsif numtype=2 then num_c := num_a - num_b; elsif numtype=3 then num_c := num_a * num_b; elsif numtype=4 then num_c := num_a / num_b; else --其它处理 dbms_output.put_line('其它处理'); end if;end;
那么如何调用存储过程
declare num_c integer;begin --调用存储过程--- proc_test(3,4,3,num_c); dbms_output.put_line('输出结果:'|| num_c );end;
输出结果
推荐教程:《oracle视频教程》
以上就是oracle的存储过程怎么调用的详细内容。
其它类似信息

推荐信息