Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6028977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:49:07+00:00 2026-05-23T04:49:07+00:00

I have a function that inserts a chunk of data into oracle database. I’m

  • 0

I have a function that inserts a chunk of data into oracle database. I’m trying to achieve this by using executemany.

My function looks like this:

  def InsertChunk(self):
    try:
      if len(self.list_dict_values) >= self.chunksize:
        self.db.cursor.executemany(
          str(self.insert_sql),
          self.list_dict_values
         )
        self.list_dict_values = []
    except cx_Oracle.Error, e:
      print e

This function is used by many tables and works fine if those tables don’t have a CLOB column in them. It works on tables with CLOB columns only when chunksize is set to 1 or 2. Sometimes it works on 3, but most of the time it doesn’t. I even got it working once when the chunksize was 4. I’m using this function to set the chunk size to something around 1000 to speed up the process.

When the chunksize is set to 3, sometimes it returns the following error:

ORA-24813: cannot send or receive an unsupported LOB.

And sometimes it says aborted and stops the script.

Any idea why this script has a different behavior every time it is run with the same parameters?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:49:08+00:00Added an answer on May 23, 2026 at 4:49 am

    I had the same problem. In my case it was caused by using the cx_Oracle variable types incorrectly. When filling out my equivalent of list_dict_values I was doing something like this:

    for row in list_dict_values:
      for key, val in row.iteritems():
         v = cursor.var(cx_Oracle.CLOB)
         v.setvalue(0, val)
         row[key] = v
    ..
    InsertChunk()
    

    Instead of many small variables, you need to create a single variable with an arraysize, then reference it in every row of your dict.

    lobdict = {}
    for k in list_dict_vals[0].keys():
       lobdict[k] = cursor.var(cx_Oracle.CLOB, arraysize=len(list_dict_vals))
    for rownum, row in enumerate(list_dict_values):
      for key, val in row.iteritems():
         lob = lobdict[key]
         lob.setvalue(rownum, val)
         row[key] = lob
    ...
    InsertChunk()
    

    It seems weird to set every row to the same value, but it works – internally the oracle code wants to iterate through a list of pointers, so that’s what you need to make.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that builds an sql query and then inserts it into
Hi i have a form (X) that inserts data into a mysql table (A)
I have a function that changes the hash in the url and inserts/removes a
We have a function header format that we have to follow. It basically looks
My two questions are: Can I use clustered indexes to speed up bulk inserts
I'm part way through building a fairly complex HTML5 web app, that retrieves its
I have a table as follows: <table> <tr> <td>col 1</td><td>col2</td> </tr> <tr id=insert> <td>field</td><td>Field
I've been fighting against IE8's compatibility mode all day and I'm about to chuck
I hate Firefox, I really do, but as a web developer I'm chained to
I'm not a good SQL programmer, I've got only the basics, but I've heard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.