Re: max length of long fields

From: Scott Urman <surman_at_dlsun338.us.oracle.com>
Date: 1996/09/22
Message-ID: <5221he$jr5_at_inet-nntp-gw-1.us.oracle.com>#1/1


In article <32432371.7A99_at_arlut.utexas.edu>, Bryan Tower <btower_at_arlut.utexas.edu> writes:
|> Hello
|>
|> I am having trouble inserting long strings into a long field. The
|> Oracle7 manual says that a long field can hold up to 2G of data (or
|> machine specific) but at present it is only holding 2K. I need it to be
|> able to hold up to 30k. The error that I am getting is "Oracle error -
|> ORA-01704: string literal too long."
|> Is there a way to check/change the max length of a long field?

Sounds like you are actually putting the string constant into the SQL statment, inside of single quotes. The limit on a quoted string literal is in fact 2000 characters, so this is the reason for the error. The solution is to use bind variables. For example, in Pro*C:

VARCHAR the_data[10000];

strcpy(the_data.arr, <a really long string>); the_data.len := strlen(the_data.arr);

EXEC SQL INSERT INTO the_table (...) VALUES (..., :the_data);

|>
|> Thanks
|> Bryan



Scott Urman Oracle Corporation surman_at_us.oracle.com

Author of _Oracle PL/SQL Programming_ ISBN 0-07-882176-2 Published by Oracle Press - http://www.osborne.com/oracle/index.htm

"The opinions expressed here are my own, and are not necessarily that of  Oracle Corporation"
Received on Sun Sep 22 1996 - 00:00:00 CEST

Original text of this message