Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: When do triggers fire vs data checks?
"Stan Brown" <stanb_at_panix.com> a écrit dans le message news: 9e0lm0$8md$1_at_panix3.panix.com...
> I am trying to upgared a third party application that logs data inot an
> Oracle 7.3.4.5 instance.
>
> The new application is getting ORA-1401 errors, and thanks to some very
> kind help from dbock_cdo_at_hotmail.com I was able to determine that the
> new application is pading a text filed with extra spaces on the end.
>
> So I put the following trigger in place to try to solve the problem:
>
>
>
> /*
> Create Triger For MWH_LOG */
> create or replace trigger MWH_LOG_trig
> before insert on MWH_LOG for each row
> declare
> l_date date;
> begin
> l_date := :new.dstamp+0;
> :new.dstamp := l_date;
> :new.brkr_id := rtrim(:new.brkr_id);
> :new.brkr_id := ltrim(:new.brkr_id);
> end;
> /
>
>
> Heres the table structure:
>
>
> SQL> describe mwh_log ;
> Name Null? Type
> ------------------------------- -------- ----
> DSTAMP DATE
> BRKR_ID CHAR(20)
> MWH_READ NUMBER
> BRKR_TYPE NUMBER(3)
>
> SQL> quit
>
> The filed BRKR_ID is the one thta's causing the 1401.
>
> However, I am still getting the 1401 error, even with this trugger in
> place!
>
> This doesn't seem to make sense to me. Are the sizes check _before_ the
> trigger fires?
>
> How can I work around this?
>
IMO, you can't because length of your data is checked in the parse step before the firing of the trigger which occurs in the execute step ot the statement.
-- Regards MichelReceived on Thu May 17 2001 - 09:17:39 CDT