begin
for i in (select header_id from tg_purchase_acc_ymd_head)  loop
         dbms_output.put_line(i);
end loop;
end;错误:PLS-00306: 调用 'PUT_LINE' 时参数个数或类型错误就是select header_id from tg_purchase_acc_ymd_head这个查询结果的数据类型问题,数据库中header_id数据类型是Number,如何才能把header_id类型改成所需要的类型

解决方案 »

  1.   


    begin
    for i in (select header_id from tg_purchase_acc_ymd_head) loop
      dbms_output.put_line(i。header_id);
    end loop;
    end;
      

  2.   

    符号输入环境错了begin
    for i in (select header_id from tg_purchase_acc_ymd_head) loop
    dbms_output.put_line(i.header_id);
    end loop;
    end;
      

  3.   

    你这里的i并不是整行,而是根据你in后面的类型
      

  4.   

    PL/SQL支持数值型for循环和游标for循环。而你的是游标for循环。你说,那我咋没有看见cursor关键字呢。因为,游标for循环可以使用select语句代替游标。
    i是一个隐式所因变量。它是游标返回记录结构的索引。可以通过(索引.列名)的形式组合在一起。就是二楼写的  i.header_id 。要是还不懂,就看看什么是游标。
      

  5.   


    恩,比较全面了。默认就是打开游标了,并且根据游标的行数进行循环相当于
    open cursor for (select ...),
    fetch cursor into i.不知道说的对不对。呵呵