oracle 的存储过程

Posted zhangzonghua

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 的存储过程相关的知识,希望对你有一定的参考价值。

 

-----推荐视频    https://ke.qq.com/webcourse/index.html#course_id=292495&term_id=100346599&taid=2156576094058127&vid=g1425sedk5c

 

-- 创建或者覆盖一个名为selects 的oracle 存储过程

create or replace
procedure selects as
--声明游标,可以传参,也可以不传
cursor lists(listsId user_yy.id%type) is select id,username from user_yy where id=listsId;
id user_yy.id%type;
username user_yy.username%type;

begin
--打开游标
open lists(3);
--循环
loop
--取出游标中的值,如果存在就赋值给变量
fetch lists into id,username;
exit when lists%notfound;
dbms_output.put_line(‘id:‘||id||‘,username:‘||username);
end loop;
--关闭游标
close lists;

end;



-- CREATE OR REPLACE PROCEDURE PROCEDURE3(id in user_yy.id%type) AS
-- user_name user_yy.username%type;
--
--BEGIN
-- select username into user_name from user_yy where id=2;
--END PROCEDURE3;




























以上是关于oracle 的存储过程的主要内容,如果未能解决你的问题,请参考以下文章

oracle 如何终止存储过程的运行!

oracle 存储过程中调用存储过程

oracle中的存储过程怎么写

oracle存储过程中循环调用存储过程

oracle存储过程里调用存储过程

请问oracle怎么执行存储过程