当前位置: 代码迷 >> Oracle开发 >> 存储过程,就20分了。
  详细解决方案

存储过程,就20分了。

热度:112   发布时间:2016-04-24 07:53:46.0
求一个存储过程,就20分了。在线等啊。

        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;

然后自循环这条语句。一直到树的最下端。




------解决方案--------------------
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;
  相关解决方案