ORA-01704 - string literal too long - in CLOB

2,142 views
Skip to first unread message

rgagnon

unread,
Mar 18, 2011, 2:43:33 PM3/18/11
to Oracle enhanced adapter for ActiveRecord
Hi,

Maybe a stupid question.

From an ActiveRecord model I try to insert an xml sting in a CLOB, if
the size of the string is less than 4000 chars it works well, but for
string bigger than 4000 I got a ORA-01704.

It is due to the way the insert statement it is done.

I know that if I use a pl/sql procedure to insert it it will work.

Any suggestions?

regards

Rémi

Raimonds Simanovskis

unread,
Mar 18, 2011, 5:39:51 PM3/18/11
to oracle-...@googlegroups.com
What is the type of column in table?
Can you prepare code example that demonstrates this issue?

Raimonds

Remi Gagnon

unread,
Mar 18, 2011, 5:57:44 PM3/18/11
to oracle-...@googlegroups.com
The type of the column is a XMLTYPE and I use a standard activerecord model to create a row.  So it generates a standard INSERT statement.

I can provide a complete test by monday if needed.

thanks in advance.

Rémi

--
You received this message because you are subscribed to the Google Groups "Oracle enhanced adapter for ActiveRecord" group.
To post to this group, send email to oracle-...@googlegroups.com.
To unsubscribe from this group, send email to oracle-enhanc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/oracle-enhanced?hl=en.

Raimonds Simanovskis

unread,
Mar 18, 2011, 6:07:46 PM3/18/11
to oracle-...@googlegroups.com
As you can see in https://github.com/rsim/oracle-enhanced/issues/#issue/56 XMLTYPE is not currently supported in oracle_enhanced adapter. Patches are welcome :)
It's necessary to handle XMLTYPE columns in the same way as CLOB columns - their value should be set in a separate write_lobs callback (https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb#L675-699) using special LOB write calls.

Remi Gagnon

unread,
Mar 18, 2011, 6:23:06 PM3/18/11
to oracle-...@googlegroups.com, Raimonds Simanovskis
Thank you,

I have not seen it, I'll try it out.



On Fri, Mar 18, 2011 at 6:07 PM, Raimonds Simanovskis <raimonds.s...@gmail.com> wrote:
As you can see in https://github.com/rsim/oracle-enhanced/issues/#issue/56 XMLTYPE is not currently supported in oracle_enhanced adapter. Patches are welcome :)
It's necessary to handle XMLTYPE columns in the same way as CLOB columns - their value should be set in a separate write_lobs callback (https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb#L675-699) using special LOB write calls.

--

Johann Vincent Paul Tagle

unread,
Mar 18, 2011, 8:30:05 PM3/18/11
to oracle-...@googlegroups.com
Hi Remi,

A few weeks ago I brought up the same thing so I'd be very interested
if you can come up with a patch. Right now I do a workaround to first
save the xml data to a clob, then call
update_all(xlm_col=xmltype(clob_col), <conditions>). Thanks

Johann

On 3/19/11, Remi Gagnon <rem.g...@gmail.com> wrote:
> Thank you,
>
> I have not seen it, I'll try it out.
>
>
>
> On Fri, Mar 18, 2011 at 6:07 PM, Raimonds Simanovskis <
> raimonds.s...@gmail.com> wrote:
>
>> As you can see in

>> https://github.com/rsim/oracle-enhanced/issues/#issue/56XMLTYPE is not


>> currently supported in oracle_enhanced adapter. Patches are
>> welcome :)
>> It's necessary to handle XMLTYPE columns in the same way as CLOB columns -
>> their value should be set in a separate write_lobs callback (
>> https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb#L675-699)
>> using special LOB write calls.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Oracle enhanced adapter for ActiveRecord" group.
>> To post to this group, send email to oracle-...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> oracle-enhanc...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/oracle-enhanced?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Oracle enhanced adapter for ActiveRecord" group.
> To post to this group, send email to oracle-...@googlegroups.com.
> To unsubscribe from this group, send email to
> oracle-enhanc...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/oracle-enhanced?hl=en.
>
>

--
Sent from my mobile device

Jaipal Singh

unread,
Jul 17, 2013, 3:39:53 AM7/17/13
to oracle-...@googlegroups.com
Hi All,

I m also doing same thing by using pl/sql block , But I want to update in column which has CLOB as a datatype by using simple update statement.
So please can you suggest me asap.
Reply all
Reply to author
Forward
0 new messages