Inconsistent data type expected CLOB but get char
<p>I want to update CLOB data type with ado.net in C#, but I don't know how to match the string data type (in C#) with CLOB data type (in oracle):    </p>

<pre><code>public static DBOperation updateMasterChild(MasterChild v_child = null, List&lt;MasterChild&gt; childRen = null)
    {
        if (v_child == null &amp;&amp; childRen == null)
            throw new ValidationFailedException("Must contain one MasterChild object for updating at least.");
        if (childRen == null)
        {
            childRen = new List&lt;MasterChild&gt;();
        }

        if (v_child != null)
            childRen.Add(v_child);

        OracleDataAdapter da = new OracleDataAdapter();
        StringBuilder sb = new StringBuilder();
        sb = sb.Append(" update MSWSCEMASTERCHILD set ticket_id = case when :ticket_id_1 is null then ticket_id else :ticket_id end,");
        sb = sb.Append(" LONGREFERENCEDATA = case when :LONGREFERENCEDATA_1 is null then LONGREFERENCEDATA else :LONGREFERENCEDATA end ");
        sb = sb.Append(" where id = :id and step_count = :step_count ");

        using (OracleConnection oraC = new OracleConnection(conStr))
        {
            OracleCommand cmd = new OracleCommand();
            cmd.Connection = oraC;
            cmd.CommandText = sb.ToString();

            oraC.Open();
            cmd.Transaction = oraC.BeginTransaction();

            try
            {
                foreach (MasterChild child in childRen)
                {
                    cmd.Parameters.Clear();

                    cmd.Parameters.AddWithValue(":ticket_id_1", child.TicketId);
                    cmd.Parameters.AddWithValue(":ticket_id", child.TicketId);

                    cmd.Parameters.AddWithValue(":LONGREFERENCEDATA_1", child.LONGREFERENCEDATA);
                    cmd.Parameters.AddWithValue(":LONGREFERENCEDATA", child.LONGREFERENCEDATA);

                    cmd.Parameters.AddWithValue(":id", child.Id);
                    cmd.Parameters.AddWithValue(":step_count", child.StepCount);

                    cmd.ExecuteNonQuery();
                }
                cmd.Transaction.Commit();
            }
            catch (Exception ex)
            {
                cmd.Transaction.Rollback();
                throw ex;
            }
        }
        return DBOperation.Success;
    }
</code></pre>

<p>LONGREFERENCEDATA in oracle is CLOB type, and property LONGREFERENCEDATA in child object is string, if I remove this updating for this field, it is OK, but if I write the updating include CLOB field, it is failed, and got an exception: expected CLOB but got char.</p>

<p>I don't know why and how to fix this problem. could you please help provide some suggestion or solutions?</p>