create or replace procedure ProcedureName 
is
cursor cur_test is
select * from table table_a
for update;begin
for rec_test in cur_test loop
update table_a 
set post_mem = (select POST_JL 
        from table_b where TEL_NO = rec_test.TEL_NO ) 
        where current of cur_test;
end loop;
commit;
end;

解决方案 »

  1.   

    liqiangliu(liqiangliu) ( )
    执行后能把POST-MEM变成 如此格式吗?
    200207FP;200208ZD;200209FP
      

  2.   

    set post_mem = (select POST_JL 
            from table_b where TEL_NO = rec_test.TEL_NO )是不是要改成 for loop 的形式, 谁能告诉我如何改呀 ,
      

  3.   

    在 Sql WorkSheet 中如何执行一个procedure ?
      

  4.   

    谢谢  bbfc1979() 还有问题:
    执行后能把POST-MEM变成 如此格式吗: 200207FP;200208ZD;200209FP  set post_mem = (select POST_JL 
            from table_b where TEL_NO = rec_test.TEL_NO )
    是不是要改成 for loop 的形式, 加个变量什么的,谁能告诉我如何改呀 ,
      

  5.   

    http://expert.csdn.net/Expert/topic/1305/1305563.xml?temp=.1603815
      

  6.   

    create or replace function get(p_id in varchar2) return varchar2 is
     Result varchar2(100);
     
     cursor rad_cursor(v_id varchar2) is
            select POST_JL from A
            where TEL_NO=v_id order by POST_JL;
    v_count Number;  
    begin
    v_count:=0;
    Result:='';
       for v_sor in rad_cursor(p_id) loop
         if v_count=0 then
           Result:=v_sor.POST_JL;
           v_count:=v_count+1;
         else
          Result:=Result||';'||v_sor.POST_JL;
         end if;
        end loop; 
       return(Result);
    end get;
    /update B set POST_MEM=(select get(TEL_NO) from A where POST_JL=B.POST_MEM)
      

  7.   

    为什么我不能把帖子放到FAQ里?