[Tutor] python cx_Oracle.LOB

Jason Massey jason.massey at gmail.com
Tue Jan 2 21:54:53 CET 2007


An example of your code would help. According to the cx_oracle docs at
http://www.python.net/crew/atuining/cx_Oracle/html/index.html under the LOB
Objects heading:

6. LOB Objects

*NOTE*: This object is an extension the DB API. It is returned whenever
Oracle CLOB, BLOB and BFILE columns are fetched.

*NOTE*: Internally, Oracle uses LOB locators which are allocated based on
the cursor array size. Thus, it is important that the data in the LOB object
be manipulated before another internal fetch takes place. The safest way to
do this is to use the cursor as an iterator. In particular, do not use the
fetchall() method. The exception "LOB variable no longer valid after
subsequent fetch" will be raised if an attempt to access a LOB variable
after a subsequent fetch is detected.

 *fileexists*( ) Return a boolean indicating if the file referenced by the
BFILE type LOB exists.

 *getfilename*( ) Return a two-tuple consisting of the directory alias and
file name for a BFILE type LOB.

 *read*( [offset = 1, [amount]]) Return a portion (or all) of the data in
the LOB object.

 *setfilename*( dirAlias, name) Set the directory alias and name of the
BFILE type LOB.

 *size*( ) Returns the size of the data in the LOB object.

 *trim*( [newSize = 0]) Trim the LOB to the new size.

 *write*( data, [offset = 1]) Write the data to the LOB object at the given
offset. Note that if you want to make the LOB value smaller, you must use
the trim() function.
I'd try the read method on your object.

On 1/2/07, Jalil <jalilsan at gmail.com> wrote:
>
> I am trying to fetch a CLOB datatype with with cx_Oracle and I can seem to
> get it to work.
>
>
>
> I was able to fetch the text from the db with sql commands  but i can
> fetch in a python code.
>
> I get this output.
>
> [(<cx_Oracle.LOB object at 0xb7f23530>,)]
>
> when I run my code.
>
> any way to find out how to go around this?
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070102/55c1133d/attachment.html 


More information about the Tutor mailing list