ORA-01704: string literal too long Oracle Data Provider for .NET

Posted on 2007-08-03
Last Modified: 2013-12-19
Hi, I am trying to insert a big text data into clob field but getting ORA-01704: string literal too long Oracle Data Provider for .NET error. Here my code that gives error.. also how to insert an xml type field from

using (OracleConnection conn = new OracleConnection(Dal.DefaultConnectionString)) {
   OracleCommand cmd = new OracleCommand("UPDATE TEST_TEMP_CLOB_TAB SET RESULT = '" + reply + "'", conn);                                

Question by:karanba
    LVL 53

    Accepted Solution

    LVL 76

    Expert Comment

    by:slightwv (䄆 Netminder)
    You really should use bind variables whenever possible.

    Just in case the above links don't help you out, here's a little test page that I hacked together from some other sample pages I had.  It was tested with and .Net 1.1
    <%@ import namespace = "" %>
    <%@ import namespace = "Oracle.DataAccess.Client" %>
    <%@ import namespace = "Oracle.DataAccess.Types" %>

    <title>Clob test</title>
    <script language="VB" runat="server">

    sub saveText(sender as object,e as eventargs)
          Dim conn As New OracleConnection("User Id=<user>;Password=<password>;Data Source=<DB>;")

          Dim cmd as OracleCommand = new OracleCommand()
          cmd.Connection      = conn

          cmd.commandText      = " insert into tab1 values(:myText) "

          Dim param1 as OracleParameter = cmd.Parameters.Add("myText", OracleDbType.Clob)

          param1.value = someTextBox.text


          catch ex as exception
                response.write("Error: " & ex.message)
          end try
    end sub

    <form id="f1" runat="server">

    Need table:<br/>
    create table tab1 ( col1 clob );

    <asp:textbox id="someTextBox" runat="server" height="200" width="100%" TextMode="multiline" />
    <asp:button causesvalidation="false" text="Save" onclick="saveText" width="100" runat="server" />


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
    Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
    This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
    Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now