1.一个带输出参数的存储过程如下
create or replace procedure count_num(name in varchar, num out number)
as
begin
select count(*) into num from region where region_name=name;
end count_num;
调用该存储过程,利用PL/SQL调用如下:
SQL> declare
2 result number(5);
3 begin
4 count_num('West',result);
5 dbms_output.put_line(result);
6 end;
7 /
2.一个不带输出参数的存储过程如下
create or replace procedure count_num2(name in varchar)
as
num number;
begin
select count(*) into num from region where region_name=name;
dbms_output.put_line(result);
end count_num2;
调用该存储过程,利用SQL*Plus直接调用如下:
SQL>execute count_num2('West');
区别 :两个标红的部分可以发现,利用PL/SQL调用存储过程是不需要execute的