oracle存储过程入门

来源:百度知道 编辑:UC知道 时间:2024/04/27 17:14:54
谁能提供一个oracle存储过程的例子.或者谁能介绍oracle存储过程入门的书.要的例子书.谢谢啊.

手头都是项目的不能给你,现去搜了一个给你

书的话,基本上没什么,多找写简单的例子看吧.
挺简单的.都是固定格式.

create or replace procedure getstudent(
in_sno in VARCHAR2(7),
out_sname out VARCHAR2(20),
out_sage out NUMBER(2)
)
is
begin
select
sname into out_sname
sage into out_sage
from student
where sno = in_sno;
exception
when NO_DATA_FOUND
return;
end getstudent;

创建存储过程:
create or replace procedure test_ppp is
c number;
begin
select count(1) into c from cat where table_type='TABLE';
DBMS_OUTPUT.put_line('表的数据量为:'||c);
end test_ppp;

在命令窗口执行:
set serverout on;--打开输出开关
execute test_ppp;--执行上面的存储过程