Run 2 queries at the same time on Oracle SQL Developer?

前端 未结 6 2055
灰色年华
灰色年华 2020-12-16 09:48

I need to retrieve quite a bit of data from our oracle DB and to do so I need to run 20+ queries. Is there any way to run more than one query at a time on the same connectio

6条回答
  •  情话喂你
    2020-12-16 10:33

    Assuming you like to live dangerously, you can run multiple "threads" from one script using the pragma AUTONOMOUS_TRANSACTION. For example:

    DECLARE
       PROCEDURE foo(i IN PLS_INTEGER) AS
          PRAGMA AUTONOMOUS_TRANSACTION;
       BEGIN
          INSERT INTO qux
             SELECT * FROM bar
             WHERE baz = i;
          COMMIT;
       EXCEPTION WHEN OTHERS THEN ROLLBACK;
       END;
    BEGIN
       foo(1);
       foo(2);
       foo(3);
    END;
    

提交回复
热议问题