加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle 存储过程遍历

发布时间:2020-12-12 13:26:51 所属栏目:百科 来源:网络整理
导读:declare ? begin ?? for i in (select * from person t where rownum10) loop ???? dbms_output.put_line(i.psn_code||‘******‘||i.zh_name); ?? end loop; end; ? ? declare ?type?v_cur?is?ref?cursor; ?v_psn?v_cur; ?v_psn_code?number; begin ??open?

declare
?
begin
?? for i in (select * from person t where rownum<10) loop
???? dbms_output.put_line(i.psn_code||‘******‘||i.zh_name);
?? end loop;
end;

?

?

declare ?type?v_cur?is?ref?cursor; ?v_psn?v_cur; ?v_psn_code?number; begin ??open?v_psn??for?select?t.psn_code?from?person?t?where?rownum<10; ???loop ?????fetch?v_psn?into??v_psn_code?; ?????????exit?when?v_psn%notfound; ?????????dbms_output.put_line(v_psn_code); ?????end?loop;? ???close????v_psn;? end;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读