Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Auto-Truncate into VARCHAR

Auto-Truncate into VARCHAR

From: Bill Buchan <bbuchan_at_ossian.net>
Date: Tue, 10 Nov 1998 12:38:03 -0000
Message-ID: <729bsc$1qi$1@phys-ma.sol.co.uk>


I'm not saying this is necessarily a good idea (I want to loose data?!) - but, I was wondering if it could be done...!

If I have a table with a VARCHAR2(n) column, and try to insert a string with
> n characters, could I automatically truncate it to n characters before
inserting? I tried to set this up using a trigger but Oracle obviously checks the data dictionary *before* it runs the trigger and returns ORA-01401 instead of truncating the text as it sees the initial value of the insert is too big for the column. Any suggestions to get round this?

Any help much appreciated!

Received on Tue Nov 10 1998 - 06:38:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US