Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: I need a trigger to automatically extend the length of a column.
Michael MacDonald wrote:
>
> I need a trigger that will automatically extend the length of a column in a
> table
> before data is inserted which would otherwise fail due to column size
> restriction.
>
> The basic logic would be similar to:
>
> create or replace trigger
> before
> insert or update
> on
> TABLENAME
> for each row
> when
> (length(new.COLUMNNAME) > columnwidth)
> begin
> update table
> TABLENAME
> modify
> (COLUMNNAME varchar2(length(new.COLUMNNAME)))
> end;
>
> Assuming that the column is of type varchar2. I am also uncertain as to how
> to determine the existing columnwidth for the when clause above.
>
> Any help would be greatly appreciated.
>
> -Michael MacDonald.
-- Jerry Gitomer ICT Group jgitomer_at_ictgroup.com Langhorne PA jgitomer_at_p3.net Opinions are mine not those of ICT GroupReceived on Tue Mar 10 1998 - 00:00:00 CST