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

Home -> Community -> Usenet -> c.d.o.tools -> Re: TRUNCATE on INSERT (ORACLE)

Re: TRUNCATE on INSERT (ORACLE)

From: Rolf Garske <garske_at_attglobal.net>
Date: Wed, 16 Aug 2000 23:01:24 +0200 (ECT)
Message-ID: <tnefxrnggtybonyarg.fzf1qc0.pminews@news2.attglobal.net>

You should know the max character count for the column you want to insert or update. If you don't, you can use getMetaData().getColumnDisplaySize(column) on a resultset that includes the column to find out. If the string to be used for the column is entered by a user, tell him that you are going to truncate it or ask him to do it.  

On Sat, 12 Aug 2000 23:40:38 GMT, uncle.scrooge wrote:

:>
:>I think I know the answer, but I'll take a shot in the dark anyway...
:>
:>
:>There's no jdbc (or database) option for
:>statement/connection/database/resultset whereas one can
:>tell the database "if this string doesn't fit, truncate it", is there???
:>
:>ie in ORACLE, how can I get this to work without altering the table or
:>making the string shorter?
:>
:>CREATE TABLE YYY ( FOO VARCHAR2(10));
:>
:>INSERT INTO YYY VALUES('abcdefghijlkmnopqrstuvwxyz');
:>
:>any help appreciated...
:>
:>thx
:>


Phone: +49 211 6914777  Mobile Phone: +49 172 2117822          Fax: +49 211 6914778
Email: garske_at_attglobal.net   CompuServe: 100023,3324         PGP Key on Request
Received on Wed Aug 16 2000 - 16:01:24 CDT

Original text of this message

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