[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4274
  • Last Modified:

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

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 asp.net

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

1 Solution
slightwv (䄆 Netminder) Commented:
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 = "system.data" %>
<%@ 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now