-----推荐视频 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;