Re: Database Error Trapping in Oracle Forms

From: Neville Sweet <sweet.neville.nj_at_bhp.com.au.no_junk_email>
Date: Thu, 22 Jul 1999 15:02:14 +1000
Message-ID: <7n692p$klb34_at_atbhp.corpmel.bhp.com.au>


Hi,

As far as I am aware, once the On-Error trigger fires it's too late to trap a database error. We cater for database errors by coding an Exception in the Form program unit where the DDL statement is issued. A Forms program unit is, after all, simply a PL/SQL block. Have a look at the Help doco on PL/SQL Exception processing.

Briefly, the technique can be demonstrated as follows: PROCEDURE my_proc IS
  ---
  CURSOR my_cursor IS
    SELECT x WHERE y FOR UPDATE OF z NOWAIT;   row_locked EXCEPTION; /* ORA-00054 Resource busy and acquire with NOWAIT. */
BEGIN
  PRAGMA EXCEPTION_INIT(row_locked, -54);   ---
  OPEN my_cursor;
  FETCH my_cursor
  etc.
  ---
EXCEPTION
  WHEN row_locked
  THEN
    message('your message');
    RAISE Form_Trigger_Failure;
END; sqb99_at_my-deja.com wrote in message <7n3ud2$lv2$1_at_nnrp1.deja.com>...
>Hi All
>
>I want to Trap database Errors in my Form and give custom messages,
>instead of database errors. I have written an On-Error Trigger at Form
>level, and have been able to catch corresponding FRM-Erros, but have
>not been able to trap SQLCODE errors, as it always return 0.
>
>I will appreciate an early response.
>
>Regards
>
>Shehzad Qamar
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Thu Jul 22 1999 - 07:02:14 CEST

Original text of this message