How to loop through a delimited list in Oracle PLSQL

后端 未结 4 1188
青春惊慌失措
青春惊慌失措 2021-01-01 05:40

I am working on an Oracle procedure that calls another procedure within it. One of my parameters (parm1) can contain one or more values in a comma separated lis

4条回答
  •  春和景丽
    2021-01-01 06:23

    CURSOR V_CUR IS
    select regexp_substr(Parm1 ,'[^,]+', 1, level) As str from dual
    connect by regexp_substr(Parm1, '[^,]+', 1, level) is not null;
    

    This curor will give you result like this

    123
    321
    

    Now iterate the cursor and call the procedure in loop.

    For i IN V_CUR
    LOOP
        callProdcedure2(i.str);
    END LOOP;
    

提交回复
热议问题