Re: oracle 8i database trigger - showing error message on a visual basic form

From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Sun, 30 Apr 2017 13:37:39 +0200
Message-ID: <emm0k4Fol9jU1_at_mid.individual.net>


On 28.04.2017 18:50, Mladen Gogala wrote: > On Thu, 27 Apr 2017 02:55:56 -0700, yemmap16 wrote:

Nothing in particular.

>> On Wednesday, 16 May 2001 02:15:14 UTC+7, Jeanette Weldon  wrote:

>>> what I need to do is show an error message on a visual basic form and
>>> force the user to enter a specific field if it is null in certain cases
>>> when the user commits the record. I cannot make the column mandatory
>>> as it must only be populated in certain cases. The user is using a
>>> visual basic form on an oracle 8i database. I do not have access to
>>> the visual basic form source code so I thought I'd try and write an
>>> oracle database trigger.
>>>
>>> below is my database trigger but I get a run-time error against the
>>> RAISE_APPLICATION_ERROR line.
>>>
>>> CREATE OR REPLACE TRIGGER sdc_moa_db_trigger BEFORE INSERT OR UPDATE
>>> OF ae_mode_of attendance ON application_events FOR EACH ROW WHEN
>>> (new.ae_mode_of_attendance
>>> IS NULL AND new.ae_evt_ref_no
>>> != '100')
>>> BEGIN
>>> RAISE_APPLICATION_ERROR(-20000,<message>);
>>> END;
>>>
>>> Jeanette
>
>
> This sounds like something that should be done in the application, not
> the database.

And the check itself seems ideal for a CHECK constraint. No need to define a trigger.

Cheers

        robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Received on Sun Apr 30 2017 - 13:37:39 CEST

Original text of this message