首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

存储过程,就20分了。

2011-12-27 
求一个存储过程,就20分了。在线等啊。createorreplaceprocedureCREATE_TESTisdemotable%rowtypeCURSORdemoI

求一个存储过程,就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;

热点排行