Skip to main content
jbird5k
Inspiring
February 17, 2009
Question

String literal too Long error

  • February 17, 2009
  • 3 replies
  • 1122 views
I have an app that uses questionnaire forms for inspections. The app is built in MX7 with an oracle 10g back end.
currently on the oracle side field sizes for the text area responses are set at 4000 bytes. However if a user enters anything close to that, I get a coldfusion error stating that the "STRING LITERAL TOO LONG". I understand this use to be an issue with versions prior to CF 5. I thought it was corrected.

Anyone have any idea how to fix this?

TIA
Jay
This topic has been closed for replies.

3 replies

Inspiring
February 23, 2009
> currently on the oracle side field sizes for the text area responses are set
> at 4000 bytes. However if a user enters anything close to that, I get a
> coldfusion error stating that the "STRING LITERAL TOO LONG".

Is the field size in bytes or characters? Are you by any chance trying to
store multi-byte character data, and counting all characters as being only
a single byte?

--
Adam
Participating Frequently
February 22, 2009
Jay, try this in your insert query:

INSERT INTO blah (SuperBigTextColumn)
values (<cfqueryparam type="CF_SQL_VARCHAR" value="#Left(FORM.SuperBigTextFromUser,3999)#">)

That'll make sure the text going in is always under 4000 chars. Alternatively...

INSERT INTO blah (SuperBigTextColumn)
values (<cfqueryparam type="CF_SQL_VARCHAR" maxlength="4000" value="#FORM.SuperBigTextFromUser#">)

This will still cause an error if more than 4K chars are entered, but you'd know that it's because there really are more than 4000 chars and not a DB driver issue.
Inspiring
February 17, 2009
Anything close to that, or anything greater than that?

Also, what command is CF trying to execute when the error occurs?