[Zope-DB] DCOracle2 Release 1, lobLocator.read() returns everytime None, update of CLOB returns "expected CLOB got BLOB" ORA-error

Johannes Heinz j.heinz at sz-sb.de
Wed Jun 23 07:55:53 EDT 2004


Hallo,

I have a  MY_SCHEMA.DOK in Oracle 9i with 2 columns:
MY_ID (VarChar2) and MY_CLOB (CLOB)

MY_CLOB contains the text "test-lobcontents"
(tested with stored procedure in Oracle)

I did run the following instructions in Python (Python-2.3.3 with 
DCOracle2 source-build)

>>> db=DCOracle2.connect(<connect-string>)
>>> cursor=db.cursor()
>>> cursor.execute("select MY_CLOB from MY_SCHEMA.DOK where MY_ID='1'")
1
>>> result=cursor.fetchone()
>>> myLobLocator=result[0]
>>>
>>> print myLobLocator.length() #returns correctly "16"
16
>>> print myLobLocator.read() #this allthough returns everytime NONE
>>> None

Is this a bug or do I have to change the instructions to work around 
this problem?

Update-problem:
>>> db=DCOracle2.connect(<connect-string>)
>>> cursor=db.cursor()
>>> cursor.execute("select MY_CLOB from MY_SCHEMA.DOK where MY_ID='1' 
for update)
1
>>> result=cursor.fetchone()
>>> myLobLocator=result[0]
>>> myLobLocator.write("----")
4
>>> cursor.execute("update MY_SCHEMA.DOK set MY_CLOB=:1 where 
MY_ID='1'",myLobLocator)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File
"/LPROD/tools/Python-2.3.3/lib/python2.3/DCOracle2/DCOracle2.py", line
973, in execute
     p = []
dco2.DatabaseError: (932, 'ORA-00932: inconsistent datatypes: expected
CLOB got BLOB')

Where does this error come from ?
The LOB-column of the table is definitely declared as CLOB.
It seems, that DCOracle2 during cursor.execute("SELECT ...") has 
returned a wrong LOB-type.
Is it possible to change the LOB-type of a Python lobLocator anyway?

I hope, that someone has an idea!

Johannes Heinz











More information about the Zope-DB mailing list