[DB-SIG] cx_Oracle CLOB.read() fails with cursor.fetchmany()

Orr, Steve sorr at rightnow.com
Thu May 13 19:53:17 EDT 2004


When I do a fetchmany (or fetchall) on a table where some of the CLOB
columns are empty it doesn't get CLOB data on non-empty CLOBs. Example:
----------------------------------------------
osql = 'select clobcol from clobtable'
ocurs.execute(osql)
rows = ocurs.fetchmany(10000)
for row in rows:
    try:print "CLOB value:\n%s\n"%row[0].read()
    except: print "CLOB value:\n%s\n"%'None'
----------------------------------------------

However if I just fetch one row at a time it works properly. Example:
----------------------------------------------
ocurs.execute(osql)
row = ocurs.fetchone()
while row:
    try:print "CLOB value:\n%s\n"%row[0].read()
    except: print "CLOB value:\n%s\n"%'None'
    try:row=ocurs.next()
    except StopIteration:break
----------------------------------------------

Is this a bug? Is there a good way to use CLOB.read() in conjuction with
fetchmany? Enhancement request if not. :-)


Steve Orr



More information about the DB-SIG mailing list