declare
type emp_table_type is table of emp_ann%rowtype index by binary_integer;
emp_table emp_table_type;
begin
select *  into emp_table from emp_ann;
dbms_output.put_line('ok');
end;
错误在什么地方啊?请大家帮帮忙

解决方案 »

  1.   

    ORA-06550: line 5, column 16:
    PLS-00597: expression 'EMP_TABLE' in the INTO list is of wrong type
    ORA-06550: line 5, column 26:
    PL/SQL: ORA-00904: : invalid identifier
    ORA-06550: line 5, column 1:
    PL/SQL: SQL Statement ignored不清楚
      

  2.   

    好像是和批量绑定有关,但是我自己也说不清楚。
    还有是不是和type emp_table_type is table of emp_ann%rowtype index by binary_integer
    这句话有关系啊?
    定义的类型不允许你这么操作啊
    请大家各抒己见,帮帮小弟吧
      

  3.   

    declare 
       type emp_table_type is table of emp%ROWTYPE
          index by binary_integer; 
       emp_table emp_table_type; 
       CURSOR cur_emp IS
          select * from emp;
       i NUMBER;
    BEGIN
       i:= 1;
       OPEN cur_emp;
       LOOP
          EXIT WHEN cur_emp%NOTFOUND;
          FETCH cur_emp INTO emp_table(i);
          i:=i+1;
       END LOOP;
       CLOSE cur_emp;
       dbms_output.put_line('ok'); 
    end;看看ORACLE关于PL/SQL面向对象编程有关概念。
      

  4.   

    我把这句select *  into emp_table from emp_ann;
    改成
    select *  bulk collect into emp_table from emp_ann;
    就没有错误了
    怎么回事啊?
      

  5.   

    谢谢3搂的哥们,能否给点资料啊
    万分感谢
    [email protected]
      

  6.   

    oracle有专门的文档,面向对象部分。
    bulk collect是一次性提取,你单条提取的话,必须用游标循环。
      

  7.   

    FETCH cur_emp INTO emp_table(i); 
    这句中为什么要写成emp_table(i)啊?直接写成emp_table行吗?
      

  8.   

    区别就像是数组里的下标。
    同一index by表的不同元素。
    因为是单条取的,所以必须不同指针。bulk collect一次性提取,故不需要。
      

  9.   


    fetch每次只能fetch一条record记录,所以用emp_table(i)。这里的emp_table(i)相当于一个record变量。
    emp_table只能一次性批量插入,就是用bulk collect into