create or replace procedure p_name
as 
cursor cur_name is
select * from other_table;
begin
for cur in cur_name loop
  if cur.字段='指定值' then
  insert into this_table values(cur.字段,...);
  end if;
end loop;
end;
/

解决方案 »

  1.   

    还可以简单:
    create or replace procedure p_name
    as 
    begin
    for cur_name in (select * from other_table)
     loop
      if cur.字段='指定值' then
      insert into this_table values(cur.字段,...);
      end if;
    end loop;
    end;
    /
      

  2.   

    create procedure pro(p1 in varchar2,p2 in varchar2,....)
    as
    num number;
    begin
    select count(1) into num from table where nvl2(p1,col1,1)=nvl(p1,1) and nvl2(p2,col2,1)=nvl(p1,1) and ....;
    end;
    /
      

  3.   

    谢谢,我是PL/SQL的新手.
    请问skystar99047(天星)的怎样理解?
    建一游标,名cur_name,cur是什么?
    haifeng1012(海风)的cur_name是什么?和cur.字段相等吗?还有那个条件不止一条,有的要2,3条
    请您加注释说明,感激不禁!
      

  4.   

    请问 游标名.检索列名  符合PL/SQL吗?