Re: Help needed with writing a Trigger
Date: 1996/11/02
Message-ID: <327B52E4.76E6_at_leaves.spb.su>#1/1
Hi, Steve!
I believe there is no way to write such a trigger you want.
Because before firing a trigger, Oracle performs datatype check.
And if the field has DATE type, and you're trying to insert a NUMBER
Oracle will respond with
ORA-00932: inconsistent datatypes.
By the way, why don't you like calling the VALDATE function within your insert startment?
Steve Dirschel wrote:
>
> I need a trigger for the following situation:
>
> Data will be sent to a table with a date field on it. But the field
> being sent to the table that cooresponds with the date field is not in a
> date format (it is a regular number field). I have writted a function
> called VALDATE to accept this numeric field and convert to a date (we
> needed to use a special function because we needed special error
> checking).
>
> We currently convert the numeric date to the "date" date by calling the
> VALDATE function within our insert startment. We want to have a trigger
> fire upon insert that will call the VALDATE function for that one row
> which will then convert that field into a date format.
>
> Can you change the format of a field with a trigger? If so, could
> someone please send me a sample of the code that would be used? I
> haven't written triggers in the past so this is why I need assistance on
> this issue.
>
> Thanks in advance
> Steve Dirschel
>
> e-mail steve_dirschel_at_cargill.com
-- Regards. Alexey Neckrasow. Leaves Inc. Russia.Received on Sat Nov 02 1996 - 00:00:00 CET