set serveroutput on;
DECLARE 
cursor cur_detail is
select *
from I_CUSTOMER
lv_customer I_CUSTOMER%ROWTYPE;
begin 
open cur_detail;
loop
fetch  cur_detail into lv_customer;
exit when lv_customer%notfound; 
DBMS_OUTPUT.PUT_LINE(lv_customer);
END loop;
close cur_detail;
end;
/

解决方案 »

  1.   

     cursor cur_detail is
    select *
    from I_CUSTOMER少了个;号?什么错误啊
      

  2.   

    一 cursor cur_detail is
    select *
    from I_CUSTOMER
    后面少了个分号,修改为from I_CUSTOMER;
    二 exit when lv_customer%notfound; 
    修改为exit when cur_detail%notfound; 
    三 游标变量只能一个字段一个字段的取值,不能一次性全部取出
    DBMS_OUTPUT.PUT_LINE(lv_customer);
    修改为  DBMS_OUTPUT.PUT_LINE(lv_customer.字段名||','||lv_customer.下一个字段名);