New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
ORA-01764 Error When Saving Text Data with RadEditor in Oracle Database
Environment
Product | RadEditor for ASP.NET AJAX |
Version | all |
Description
I encounter the ORA-01764 "String literal too long" error in Oracle when saving text data using RadEditor. The database column is of type VARCHAR2
, and the text size, including HTML markup, exceeds the 4000-byte limit allowed for VARCHAR2
columns in SQL statements. Even though the visible text is smaller, the error occurs due to the inclusion of HTML tags and formatting generated by RadEditor.
Cause
The ORA-01764 error is caused when the data being inserted or updated exceeds the 4000-byte limit set for VARCHAR2
columns in Oracle. The limit applies to the total size of the content, including HTML tags and formatting, not just the visible text.
Solution
Option 1: Use CLOB for Large Text Content
- Change the database column type from
VARCHAR2
toCLOB
. - CLOB columns can store large text content without the 4000-byte restriction.
- Modify the SQL statements and data access code to handle CLOB data types.
Option 2: Restrict Content Size in RadEditor
- Set the
MaxHtmlLength
property in RadEditor to 4000 or less to prevent exceeding the database limit.
asp.net
<telerik:RadEditor ID="RadEditor1" runat="server" MaxHtmlLength="4000" />
- Note that this limit includes all HTML markup, not just plain text.
Properties for Limiting Content
MaxHtmlLength
: Restricts the total length of the HTML content, including tags.MaxTextLength
: Restricts the plain text length, excluding HTML tags.
These properties enforce size limitations before the data reaches the database.