dbTalk Databases Forums  

presenting user-friendly error messages

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss presenting user-friendly error messages in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Thomas Blankschein
 
Posts: n/a

Default presenting user-friendly error messages - 12-10-2004 , 02:43 AM






Hello,

an Oracle-DB with several constraints does complain correctly if a user
tries to insert data over the frontends which do not fit to the check
constraints. Unfortunately in such a case only an message like 'ORA-XXXX
Constraint CHK_CUSTOMER_ID violated' is displayed.
How can I present a more informative message to the user with a description
of the error and hints to avoid it? And this independend from the frontend?
My first thought is an additional table in the database with all the
constraint names and corresponding text messages in it. In case of an error
every frontend has to read this information from the table and displays it
to the user.

Thanks,
Thomas




Reply With Quote
  #2  
Old   
Frank Piron
 
Posts: n/a

Default Re: presenting user-friendly error messages - 12-10-2004 , 03:03 AM






Fri, 10 Dec 2004 09:43:30 +0100 Thomas Blankschein <thomas (AT) blankschein (DOT) de>
wrote:

Quote:
Hello,

an Oracle-DB with several constraints does complain correctly if a user
tries to insert data over the frontends which do not fit to the check
constraints. Unfortunately in such a case only an message like 'ORA-XXXX
Constraint CHK_CUSTOMER_ID violated' is displayed.
How can I present a more informative message to the user with a
description
of the error and hints to avoid it? And this independend from the
frontend?
Independent from the frontend? For that you have to build a server
side software layer (Pl/sql packages for example) which catches the
exception und returns a readable and context driven message to the
frontend.
As a workaround (but IMO it is not a good design) you may write a
pre-insert trigger for the table in question. In the code of the
trigger you may check the constraint with procedural logic and then
use "raise_application_error()" to return a context driven message to
the frontend. In this case don't remove the declarative check-constraint
from the table! It's good for documentation and also if the trigger
once vanishes :-)

Regards
--
Frank Piron,
defrankatkonaddot
(leftrotate two)


Reply With Quote
  #3  
Old   
Sybrand Bakker
 
Posts: n/a

Default Re: presenting user-friendly error messages - 12-11-2004 , 09:51 AM



On Fri, 10 Dec 2004 09:43:30 +0100, "Thomas Blankschein"
<thomas (AT) blankschein (DOT) de> wrote:

Quote:
How can I present a more informative message to the user with a description
of the error and hints to avoid it?
on server error triggers in 8i and higher.


--
Sybrand Bakker, Senior Oracle DBA


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.