2

I have a PL/SQL script like this...

DECLARE
      CURSOR curs_delete
      IS      
         SELECT cus_num
          FROM dob.cust_table GROUP BY cust_num HAVING COUNT(*)>1;                
      TYPE row_cust_num IS TABLE OF dob.cust_table.cust_num%TYPE;      
      col_cust_num row_cust_num;
   BEGIN
      OPEN curs_delete;
      LOOP
         FETCH curs_delete
         BULK COLLECT INTO col_cust_num LIMIT 10000;
         EXIT WHEN col_cust_num.EXISTS (1) = FALSE;
         FORALL i IN 1 .. col_cust_num.LAST
            DELETE FROM cust_table 
             WHERE cust_num = col_cust_num (i);
             COMMIT;
      END LOOP;
      CLOSE curs_delete;
END;

This query returns ORA-12805:parallel query server died unexpectedly error. I'm not sure why it is happening. The select query in cursor returned around 415 records when i got this error.

Anyone understand why this error comes up?

4

1 回答 1

4

This is a problem for your DBA to resolve, as there are a large number of possible causes. Somebody needs to look in the Alert Log and check for trace files in the bdump directory for diagnostic info.

In the meantime, if you have only 415 records to delete you should just use straight SQL:

DELETE FROM cust_table
WHERE cust_num in (SELECT cus_num           
                   FROM dob.cust_table 
                   GROUP BY cust_num HAVING COUNT(*)>1);  
于 2012-09-05T10:01:22.293 回答