如下题 请经常写存储过程 懂数据库Oracle 或者你知道如何写都帮帮我

1个回答

  • create procedure test is

    cursor custom_list is

    select id from khexpinfo;

    custom_dic custom_list%ROWTYPE;

    my_custom_id in number(20);

    begin

    for custom_dic in custom_list loop

    begin

    select distinct b.customer_id into my_custom_id from centermaterialusedetail c ,batchinfo b where c.export_uid=custom_dic.id and c.batchinfo_uid=b.fuid;

    update khexpinfo set customer_id=my_custom_id where id=custom_dic.id;

    exception when others then

    my_custom_id:=0;

    end;

    end loop;

    commit;

    end;