Problems with triggers

From: Frederic Lesieur <Frederic.Lesieur_at_dmr.ca>
Date: 1995/04/19
Message-ID: <3n3hpm$6e8_at_guillotine.mtl.dmr.ca>#1/1


Hy,

My problem is that I want to restrict the access on a table to a user under certain condition.

I want this user to be able to update the table in the case where a table's field called TYPE is not equal to 'S'. Otherwise, if ='S', then Oracle should send a error message saying that the update of the table is impossible.

To do that, I have created a BEFORE trigger associated with the table that is fired for each update of table.

If the condition is true, i.e. TYPE = 'S', then I issue the following error message with the function:

        raise_application_error(-20501, 'Update unavailable')

The problem is there. The message appears on the screen, but with other messages from Oracle saying that the trigger has failed.

	ORACLE - 20501 'Update unavailable'
	ORACLE - XXXXX 'ERROR line 1'
	ORACLE - XXXXX 'Error in the execution of trigger'

How can I avoid these last two messages from within a trigger?

Or, is there any other way of stopping an update from within a trigger?

The only way that I've found is with trigger.

Thanks!

Martin Miron

e-mail: Martin.Miron_at_dmr.ca Received on Wed Apr 19 1995 - 00:00:00 CEST

Original text of this message