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

Home -> Community -> Usenet -> c.d.o.server -> Re: ORA-01704: how to insert long strings ?

Re: ORA-01704: how to insert long strings ?

From: Yass Khogaly <ykhogaly_at_us.oracle.com>
Date: Fri, 16 Jul 1999 02:45:06 -0700
Message-ID: <7mmreh$cj5$1@inet16.us.oracle.com>


There is a limitation in SQL*Plus that you cannot have more than 255 characters inserted into a LONG column. A workaround is to write a PL/SQL script and use a local variable to store the value first, then insert it into the LONG column.
Note that the maximum size of a local variable is 32k.

For example, this is a solution in Pro*C:

EXEC SQL begin declare section;

  varchar long_val[10000]; /* Bind variable to store the column value */

EXEC SQL end declare section;

  strcpy(long_val.arr, "A really really long hardcoded string which used to \

         be inside single quotes");

  long_val.len = strlen(long_val.arr);

EXEC SQL insert into table (..., long_column, ...)   values (..., :long_val, ...);

Note the use of the bind variable, rather than the hardcoded string.



Yass Khogaly
Senior Principal Consultant -Core Technology Services Oracle Consulting
Oracle Corporation
ykhogaly_at_us.oracle.com

"The Views expressed here are my own and not necessarily those of Oracle Corporation"

Andreas Jung <ajung_at_saarland.sz-sb.de> wrote in message news:7mk8ma$sqf$1_at_hades.rz.uni-sb.de...
> Oracle 7.3.3 complains with
> OracleDbError: PARSE caused a ORA-01704: string literal too long
> when I try to insert a long string (2000 chars and more) into a column
> of type LONG. How can I get around this problem ?
>
> Thanks
> Andreas
>
> --
> _\\|//_
> (' O-O ')
> ------------------------------ooO-(_)-Ooo---------------------------------



> Andreas Jung, Saarbrücker Zeitung Verlag und Druckerei GmbH
> Saarbrücker Daten-Innovations-Center
> Gutenbergstr. 11-23, D-66103 Saarbrücken, Germany
> Phone: +49-(0)681-502-1563, Fax: +49-(0)681-502-1509
> Email: ajung_at_sz-sb.de (PGP key available)
> --------------------------------------------------------------------------

Received on Fri Jul 16 1999 - 04:45:06 CDT

Original text of this message

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