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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: problem with dynamic sql

RE: problem with dynamic sql

From: Kevin Lange <kgel_at_ppoone.com>
Date: Wed, 06 Jun 2001 14:28:50 -0700
Message-ID: <F001.0031F4CB.20010606143250@fatcity.com>

You need to start using Exception coding in your sql.

Basiclly ...

Begin
  ....
  coding
  ...
Exception
  When Error
  Then

     Do this
End;

Encase your sql statements in the begin/exception/end construct and code accordingly. Here is an example. In this case, on thye update statement, if I encounter an error, I go to the Exception block. This block does not bother about specific errors, which you can do, I just handle ever error the same. I set some variables and call my error handling routine, update_log_error. Look at some of the Oracle books under EXCEPTIONS. The ORACLE PL/SQL PROGRAMMING book by Steven Feurstein is a real good source for this.

   Begin

     Update prov$.prof_fed_tax_ids
     Set tax_id_status = 'INVALID'
     Where prov_id    = cur_inv_pfti_rec.prov_id
       and fed_tax_id = cur_inv_pfti_rec.fed_tax_id;
   Exception
     When Others
     Then
       v_ongoing_load_id       := cur_inv_pfti_rec.ongoing_load_id ;
       v_external_prov_id      := cur_inv_pfti_rec.external_prov_id;
       v_external_grp_id       := ''                               ;
       v_external_agree_id     := ''                               ;
       v_ongoing_table_name    := 'ONGOING1_PROF_FED_TAX_IDS'      ;
       v_ongoing_column_name   := ''                               ;
       v_ongoing_default_value := ''                               ;
       v_discard_value         := ''                               ;
       v_discard_status        := 'FATAL'                          ;
       v_discard_reason        := sqlerrm                          ;
       update_log_error
         (
           v_ongoing_load_id,
           v_external_prov_id,
           v_external_grp_id,
           v_external_agree_id,
           v_ongoing_table_name,
           v_ongoing_column_name,
           v_ongoing_default_value,
           v_discard_value,
           v_discard_status,
           v_discard_reason
         );

  End;

-----Original Message-----
Sent: Wednesday, June 06, 2001 3:59 PM
To: Multiple recipients of list ORACLE-L

Hi,

I am running couple of ddl statements dynamically.... problem is whenever oracle is unable to execute particlar statement it just exit from procedure and don't go to next statement.
How to modify syntax.........

Thanks
Harvinder
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Harvinder Singh
  INET: Harvinder.Singh_at_MetraTech.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Kevin Lange
  INET: kgel_at_ppoone.com
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed Jun 06 2001 - 16:28:50 CDT

Original text of this message

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