Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Varchar truncating question
Hi!
AFAIK there's no such option.
An alternative is to write a trigger that's truncates the varchar's to specfied length.
create or replace
trigger tr_on_table_xyz
on insert and update
for each row
begin
:NEW.column1:= substr(:NEW.column1, 1, spec_length_column1);
:NEW.column2:= substr(:NEW.column2, 1, spec_length_column2);
...
end;
/
Repeat this for all columns of your table.
Hope this helps,
Stefan.
<bcliff_at_my-deja.com> schrieb in im Newsbeitrag:
8oe020$bah$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?
> Currently, oracle will return an error. What I'm really looking for is
> a flag to set so that oracle truncates by default instead of returning
> an error. Thanks.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Aug 28 2000 - 12:37:07 CDT
![]() |
![]() |