Re: User friendly error massage in dev6i

From: Tiago Rocha <tiagocrspamtalho_at_terra.com.br>
Date: Tue, 23 Dec 2003 11:31:09 -0300
Message-ID: <e4kguv00pn15om4vb1plm659blqnmio9st_at_4ax.com>


On 23 Dec 2003 05:41:09 -0800, m004202002_at_yahoo.com (why) wrote:

>When we impliment rules creating the table
>if that rules violated we get error in sqlplus
>
>like
>" ORA-00001: unique constraint (USER2.SYS_C001584) violated "
>
>My question is how i can show that error in
>dev6i . Means i know that it will violate
>ora-00001 ,so i want to show a massage to
>the user that he/she entered " same data again"
>Make it user friendly .

You can create an exceptions block on your pl/sql code or use an "on-error" trigger. The online help for on-error is very clear... There are some examples there... If you use exceptions block, you can check for "dup_val_on_index" exception and then check sqlerrm built in to verify what constraint was broken.

Example:

Begin
  <your code here>
Exception
  When dup_val_on_index then
    if Instr( SqlErrM, 'USER2.SYS_C001584' ) > 0 then       message( <your friendly message here> ) ;    end if ;
  When Others then
    raise ;
end ;

hope this helps.

-- 
Tiago Rocha
Recife - Brasil
www.diariodastrilhas.cjb.net
Received on Tue Dec 23 2003 - 15:31:09 CET

Original text of this message