美文网首页
pl/sql游标

pl/sql游标

作者: Jianbaozi | 来源:发表于2022-12-20 00:07 被阅读0次
    image.png
    declare
    ie_id NUMBER(10);
    ie_fn varchar2(20);
    ie_ln varchar2(20);
    ie_ge char(1);
    cursor ie_cur is select ID,FIRST_NAME,LAST_NAME,GENDER from it_employees;
    begin
    open ie_cur;
    fetch ie_cur into ie_id,ie_fn,ie_ln,ie_ge;
    loop 
     exit when not ie_cur%found;
     if ie_ge='1' then insert into it_employees_m(id,first_name,last_name,gender) values(ie_id,ie_fn,ie_ln,ie_ge);
     else 
       insert into it_employees_f(id,first_name,last_name,gender) values(ie_id,ie_fn,ie_ln,ie_ge);
     end if;
     fetch ie_cur into ie_id,ie_fn,ie_ln,ie_ge;
     end loop;
     close ie_cur;
     end;
    

    相关文章

      网友评论

          本文标题:pl/sql游标

          本文链接:https://www.haomeiwen.com/subject/ehyuqdtx.html