Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Explicit Cursor in a For Loop and crashing database

Re: Explicit Cursor in a For Loop and crashing database

From: Jan <janik_at_pobox.sk>
Date: 23 Sep 2003 00:21:36 -0700
Message-ID: <81511301.0309222321.471c95b@posting.google.com>


Could not find the error, what is the Oracle saying (error number)? BTW, I would rewrite your code as following:

  1. Instead of CURSORS and LOOPs, I would use single SQL..

   INSERT INTO my_table(col1

                      , col2...) 
            SELECT x1,
                   x2 
               FROM other_table
                  WHERE ...

   IF SQL%FOUND THEN
      INSERT INTO ...

   END IF;     2) your Exception

      WHEN OTHERS THEN ROLLBACK, RAISE
    is not necessary. Exactly this will be done by Oracle if you don`t write any axception

3) I would use

   INSERT INTO my_table (col1...) VALUES (my_sequence.nextval...

   instead of    

   SELECT my_sequence.nextval INTO my_variable FROM DUAL;    INSERT INTO my_table (col1...) VALUES (my_variable...

   Your aproach is not wrong, but more code. More code, harder to read, etc...

Regards, Jan Received on Tue Sep 23 2003 - 02:21:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US