create or replace procedure CREATE_TEST is
    demo table %rowtype;
CURSOR demo IS select * from table a where a.name = ?
    begin
  open demo ;
        fetch demo into table ;
         EXIT WHEN demo %NOTFOUND;如果有一条记录那么往下执行。
得到这条记录的一个字段为条件。
如果没有就返回。select * from table a where a.type = table.type;然后自循环这条语句。一直到树的最下端。

解决方案 »

  1.   

    create or replace procedure CREATE_TEST is
        demo table %rowtype;
    CURSOR demo IS select * from table a where a.name = ?
        begin
      open demo ;
      loop
            fetch demo into table ;
             EXIT WHEN demo%NOTFOUND;
           /*添加代码*/
      end loop;end;
      

  2.   

    我就是想知道。如何把很多条select * from table a where a.type = table.type;记录循环放进一个游标里返回。谢谢了~~