how to manage CLOB type with cx_oracle

Loredana loredana.pier at gmail.com
Tue Mar 3 16:33:19 CET 2009


On Mar 3, 1:01 pm, Loredana <loredana.p... at gmail.com> wrote:
> Hi,
>
> I need to read CLOB field type (it is long text)
>
> if I use this code:
>
> curs.execute(sqlstr)
> rows['name_of_columns']     =   name_of_columns
> rows['data']                         =   curs.fetchall()
>
> it returns me this values:
>
> test = {'name_of_columns': ['FILENAME', 'CRONTIME', 'SHORT_TAIL',
> 'LONG_TAIL'], 'data': [('dd','asdds','adadsa',<cx_Oracle.LOB object at
> 0x2a955bc230>')]}
>
> any ideas?
>
> Thanks
>
> Lory

Hi all,
I success to read one row with the following code:

        curs.execute(sqlstr)
        name_of_columns =   []
        for fieldDesc in curs.description:
            name_of_columns.append(fieldDesc[0])
        for rows_ in curs.fetchone():
            try:
                print rows_.read()
            except:
                print "except. ",rows_

but if I try with fetchmany() it doesn't work
any ideas?

thanks

Loredana



More information about the Python-list mailing list