SQL> create or replace procedure readData(rowData out a_luo%rowtype) as
  2  declare
  3   cursor cs is select * from a_luo;
  4  begin
  5   for x in cs loop
  6    rowData:=x;
  7   end loop;
  8  end;
  9  /警告: 创建的过程带有编译错误。SQL> create or replace procedure soldierluo.readData(rowData out a_luo%rowtype) as
  2  declare
  3   cursor cs is select * from a_luo;
  4  begin
  5   open cs;
  6   while cs%found loop
  7    fetch cs into rowData;
  8   end loop;
  9   close cs;
 10  end;
 11  /警告: 创建的过程带有编译错误。

解决方案 »

  1.   

    CS是一个游标,这个游标会有具体的属性
    改成: fetch cs.rowdata into rowData;
      

  2.   

    我在1楼说的有错,不好意思,没注意看你rowData的类型
      

  3.   

    SQL> create or replace procedure soldierluo.readData(rowData out a_luo%rowtype) as
      2  declare
      3   cursor cs is select * from a_luo;
      4  begin
      5   open cs;
      6   while cs%found loop
      7    fetch cs into rowData;
      8   end loop;
      9   close cs;
     10  end;
     11  /rowData是什么?你查询的是的数据,每一条有多少列?列多项的话,能赋值给rowdata吗?
    %rowtype 定义一个基于游标的记录变量
    cs_record    cs%rowtype
      

  4.   


    create or replace procedure readData(没有传入值,rowData out a_luo%rowtype) is
    写个cursor给你参考下
    declare
    cursor a_luo is
    select bdNo,bdName,dName
    from BusDriver b, Depot d
    where b.dNo = d.dNo;
    start_a_luo  a_luo%rowtype;begin
    open a_luo;
    fetch a_luo into start_a_luo;
     while a_luo%found loopdbms_output.put_line( start_a_luo.bdNo || ‘ ’ ||
    start_a_luo.bdName|| ‘’ || start_a_luo.dName ||‘ depot ’ );
    fetch a_luo into start_a_luo;--第二个fetch是再次注入
    end loop;
    close a_luo;
    end;