|
| 1 | +--- |
| 2 | +title: ORA-01764 Error When Saving Text Data with RadEditor in Oracle Database |
| 3 | +description: Troubleshooting the ORA-01764 "String literal too long" error when saving data with RadEditor in an Oracle database using a VARCHAR2 column. |
| 4 | +type: troubleshooting |
| 5 | +page_title: Solving ORA-01764 Error in RadEditor When Saving Text to Oracle Database |
| 6 | +meta_title: Solving ORA-01764 Error in RadEditor When Saving Text to Oracle Database |
| 7 | +slug: ora-01764-error-radeditor-saving-text-oracle |
| 8 | +tags: radeditor, asp.net ajax, ora-01764, clob, varchar2, maxhtmllength, error |
| 9 | +res_type: kb |
| 10 | +ticketid: 1693150 |
| 11 | +--- |
| 12 | + |
| 13 | +## Environment |
| 14 | +<table> |
| 15 | +<tbody> |
| 16 | +<tr> |
| 17 | +<td> Product </td> |
| 18 | +<td> RadEditor for ASP.NET AJAX </td> |
| 19 | +</tr> |
| 20 | +<tr> |
| 21 | +<td> Version </td> |
| 22 | +<td> all </td> |
| 23 | +</tr> |
| 24 | +</tbody> |
| 25 | +</table> |
| 26 | + |
| 27 | +## Description |
| 28 | + |
| 29 | +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. |
| 30 | + |
| 31 | +## Cause |
| 32 | + |
| 33 | +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. |
| 34 | + |
| 35 | +## Solution |
| 36 | + |
| 37 | +### Option 1: Use CLOB for Large Text Content |
| 38 | + |
| 39 | +1. Change the database column type from `VARCHAR2` to `CLOB`. |
| 40 | +2. CLOB columns can store large text content without the 4000-byte restriction. |
| 41 | +3. Modify the SQL statements and data access code to handle CLOB data types. |
| 42 | + |
| 43 | +### Option 2: Restrict Content Size in RadEditor |
| 44 | + |
| 45 | +1. Set the `MaxHtmlLength` property in RadEditor to 4000 or less to prevent exceeding the database limit. |
| 46 | + |
| 47 | +```asp.net |
| 48 | +<telerik:RadEditor ID="RadEditor1" runat="server" MaxHtmlLength="4000" /> |
| 49 | +``` |
| 50 | + |
| 51 | +2. Note that this limit includes all HTML markup, not just plain text. |
| 52 | + |
| 53 | +### Properties for Limiting Content |
| 54 | + |
| 55 | +- `MaxHtmlLength`: Restricts the total length of the HTML content, including tags. |
| 56 | +- `MaxTextLength`: Restricts the plain text length, excluding HTML tags. |
| 57 | + |
| 58 | +These properties enforce size limitations before the data reaches the database. |
| 59 | + |
| 60 | +## See Also |
| 61 | + |
| 62 | +- [RadEditor MaxHtmlLength Property](https://www.telerik.com/products/aspnet-ajax/documentation/controls/editor/managing-content/max-content-length-) |
| 63 | +- [Oracle Data Types Documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Data-Types.html) |
0 commit comments