创建游标后面跟着sql语句,然后打开游标、循环游标的内容直到游标内容循环结束。关闭游标。
–需求:打印业主类型为 1 的价格表
declare
cursor cur_pricetable is select from t_pricetable where ownertypeid=1;–声明游标
v_pricetable t_pricetable%rowtype;
begin
open cur_pricetable;–打开游标
loop
fetch cur_pricetable into v_pricetable;--提取游标 exit when cur_pricetable%notfound;--退出循环游标 dbms_output.put_line('价格:'||v_pricetable.price|| ' 吨位:'||v_pricetable.minnum||'-'||v_pricetable.maxnum);
end loop;
close cur_pricetable;–关闭游标
end;

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/265403.html