| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Varchar truncating question
The trigger should work, although it'll slow down update/insert transactions on the database. If you're doing custom development, developers should have enough discipline to use a SUBSTR in their own code. It's faster, teaches them, and you won't have to put triggers on every varchar2 column.
Steffen Göck wrote:
>
> <bcliff_at_my-deja.com> schrieb in im Newsbeitrag:
> 8oe06i$bih$1_at_nnrp1.deja.com...
> > Is there any way to get oracle to automatically truncate an entry into a
> > varchar column if the entry is longer than the specified length?
>
> create a rowlevel trigger for insert and update trigger on the table:
>
> begin
> :new.MyTextField := substr(:new.MyTextField ,1,TheMaxLength);
> end;
>
> Steffen
--
---------------------------------------------------------------------
Chad Thompson,
Programmer Analyst: VB, VC++, PLSQL, Oracle HRMS, Security Apps
Home: thomp901_at_micron.net
Thou shalt not tick off the dragon.... for thou art crunchy and
taste good with ketchup.
---------------------------------------------------------------------
--
Received on Tue Aug 29 2000 - 21:27:54 CDT
![]() |
![]() |