您的位置:首页 > 数据库 > Oracle

Oracle:创建存储过程

2017-05-16 15:00 211 查看
1.无参存储过程

create or replace procedure test_proc
as
v_total number(10);
begin
select count(*) into v_total from F_RELATION;
DBMS_OUTPUT.put_line('总人数:'||v_total);
end;

begin
test_proc;
end;

2.有参存储过程

create or replace procedure test_proc(
v_name in VARCHAR2,
anum in varchar2 ,
cid in integer default 100
)
as
v_total number(10);
begin
select count(*) into v_total from F_RELATION;
DBMS_OUTPUT.put_line('总人数:'||v_total||',id='||v_name||',anum='||anum||',cid='||cid);
end;

begin
test_proc('101','this is anum');
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: