ORA-01461 error when trying to save a CLOB text field generated by a template. What do I do to fix this?

Asked

Viewed 60 times

0

Error trying to save a record in Lotemail class.

table:

lotemail
LOTEMAILID            NOT NULL NUMBER(18)    
LOTEMAILCORPO                  CLOB    

Class:

class Lotemail(models.Model):
    lotemailid             = models.BigIntegerField( primary_key=True)  
    lotemailcorpo          =  models.TextField()

    class Meta:
        db_table = 'lotemail'

Excerpt from the Routine:

lotemail = Lotemail() lotemail.lotemailcorpo = content lotemail.save()

In the above routine the variable "content" is a String, generated from a list of objects that goes to a template in HTML layout.

Which is strange that in one routine it works and in the other it doesn’t.

I checked String size and error length is smaller than the one that works, and the template has the same charset (what works and what goes wrong).

Error:

DatabaseError at /procedimentos/previsao/notas/preview

ORA-01461: can bind a LONG value only for insert into a LONG column

Request Method:     POST
Request URL:    http://127.0.0.1:8000/procedimentos/previsao/notas/preview
Django Version:     1.6.5
Exception Type:     DatabaseError
Exception Value:    

ORA-01461: can bind a LONG value only for insert into a LONG column

Exception Location:     /usr/lib64/python2.7/multiprocessing/pool.py in get, line 554
Python Executable:  /root/Documentos/desenvolvimento/intranet-master/venv/bin/python
Python Version:     2.7.5

I ask for some suggestion to help me correct this.

1 answer

0

The mistake "ORA-01461: can bind a LONG value only for Insert into a LONG column" refers to some restrictions that guy LONG has.

As a suggestion, as per this answer in SOEN, you can:

  • create the column as being varchar2, determining the size according to the maximum number of digits, or
  • insert in the field a counter type value of up to 20 characters.
  • Creating a table with a column of varchar2 (20 or any arbitrary length) and
  • inserting into the above table with a Row containing more than 20 characters

OBS: in the very answer of SOEN lynched there are some other alternatives that may even better solve your problem, worth taking a look.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.