--存储过程
--in
--调用存储过程
--in,out
--inout输入输出
--in
create or replace procedure inpro(pname in varchar2,price in number) as
begin
declare e_count number;
begin
select max(id) into e_count from product;
insert into product values(e_count+1,pname,price);
end;
end inpro;
--调用存储过程
begin
inpro('yang','5000');
end;
--in,out
create or replace procedure inoutpro(p_name in varchar2,p_count out number) as
begin--给输出参数要赋值
select count(*) into p_count from product where pname=p_name;
end inoutpro;
begin
declare p_count number;--定义变量接收存储过程返回的参数
begin
inoutpro('ronaldo',p_count);--传入输入参数,并且定位输出参数
dbms_output.put_line(p_count);
end;
end;
--inout输入输出
create or replace procedure inandoutpro(a in out number,b in out number) as
begin
a:=a+b;
b:=a-b;
a:=a-b;
end inandoutpro;
begin
declare a number :=5;
b number :=7;
begin
inandoutpro(a,b);
dbms_output.put_line(a||'---'||b);
end;
end;

25万+

被折叠的 条评论
为什么被折叠?



