由于时间有限。现在只是拿出两个最基本的存储过程的例子。oracle存储结构语法也许以后会补上。
1.两个最基本的存储过程的例子
--建表并插入两行数据
drop table temp;
create table temp(id int);
insert into temp values(1);
insert into temp values(2);
--建立一个有输入参数的存储过程
create or replace procedure proc1(param in int) as
begin
insert into temp values(param);
end proc1;
/
--调用
exec proc1(10000);
--建立一个有输入参数且有返回值得存储过程
create or replace procedure proc2(param1 in int, param2 out int) as
begin
select id into param2 from temp where id = param1;
end proc2;
/
--调用并显示
var OUT_P number;
exec proc2(10000, :OUT_P);
print :OUT_P;
可以把上面的内容保存为一个sql文件在sqlplus中执行试试。