本文分类:
Oracle

Demo PL/SQL

declare
    type task_id_list_type is varray(1000) of varchar2(20);

    taskIdList     task_id_list_type;
    v_demo_clob    clob;
    v_taskId       varchar(20);
begin
    taskIdList := task_id_list_type(
        '12345678901234567890',
        '12345678901234567891',
        '12345678901234567892'
    );

    select t.detail
     into v_demo_clob
     from t_demo
    where t.id = 'id';

    for i in 1 .. taskIdList.count loop
        v_taskId := taskIdList(i);
        insert into t_wait
            select * from t_fail a
            where a.task_id = v_taskId;
        delete from t_fail a where a.task_id = v_taskId;
    end loop;
end;
/
本文来自 [时光记 - 王智超的个人空间](www.hiwzc.com),转载请注明出处。