存储过程一则 备忘

[复制链接]
查看11 | 回复0 | 2013-3-11 17:05:00 | 显示全部楼层 |阅读模式
好长时间不写存储过程,居然忘了过程中的out参数如何输出,真汗!


将过程记录下来备查。
很简单的一个存储过程
--table---
test(id int,name varchar2(10));
--create--
create or replace procedure ASAS(idint,

name out varchar2 ) as
begin
select name into name from test where id = id;
dbms_output.put_line(name);
exception
when no_data_found then
dbms_output.put_line('no such bill');
end;
/
---exec----
2种方式
no 1.
SQL> DECLARE
2name varchar(2);
3BEGIN
4ASAS(1,:name);
5END;
6/
test
test
PL/SQL procedure successfully completed
name
---------
test

no 2.
SQL> var name varchar2(10);
SQL> call asas(1,:name);
Method called
name
---------
test
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行