The database is
Oracle Database 21c Express Edition Release 21.0.0.0.0
The script
import sys, platform, oracledb print("platform.platform:", platform.platform()) print("sys.maxsize > 2**32:", sys.maxsize > 2**32) print("platform.python_version:", platform.python_version()) print("oracledb.__version__:", oracledb.__version__)
reports
platform.platform: macOS-15.3.1-arm64-arm-64bit-Mach-O
sys.maxsize > 2**32: True
platform.python_version: 3.13.2
oracledb.__version__: 3.0.0
Code that worked with oracledb
2.5.1 now raises a
oracledb.exceptions.DatabaseError: ORA-22922: nonexistent LOB value
I have the following procedure:
CREATE OR REPLACE procedure placeholders_replace(
p_eq_body in out clob
)
as
begin
null;
end;
And I try to call it with the following Python code:
#!python import oracledb db = oracledb.connect(f"user/owd@db") c = db.cursor() query = "begin PLACEHOLDERS_REPLACE(p_eq_body=>:p_eq_body); end;" eq_body = c.var(oracledb.DB_TYPE_CLOB) eq_body.setvalue(0, "foo") c.execute(query, {"p_eq_body": eq_body}) print("eq_body", eq_body.getvalue(0))
This gives the following stack trace
eq_body Traceback (most recent call last):
File "/Users/walter/x/oracledb_clob_bug.py", line 18, in <module>
print("eq_body", eq_body.getvalue(0))
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/walter/pyvenvs/default/lib/python3.13/site-packages/oracledb/lob.py", line 108, in __str__
return self.read()
~~~~~~~~~^^
File "/Users/walter/pyvenvs/default/lib/python3.13/site-packages/oracledb/lob.py", line 170, in read
return self._impl.read(offset, amount)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "src/oracledb/impl/thin/lob.pyx", line 351, in oracledb.thin_impl.ThinLobImpl.read
File "src/oracledb/impl/thin/lob.pyx", line 269, in oracledb.thin_impl.ThinLobImpl._process_message
File "src/oracledb/impl/thin/protocol.pyx", line 447, in oracledb.thin_impl.Protocol._process_single_message
File "src/oracledb/impl/thin/protocol.pyx", line 448, in oracledb.thin_impl.Protocol._process_single_message
File "src/oracledb/impl/thin/protocol.pyx", line 440, in oracledb.thin_impl.Protocol._process_message
File "src/oracledb/impl/thin/messages.pyx", line 103, in oracledb.thin_impl.Message._check_and_raise_exception
oracledb.exceptions.DatabaseError: ORA-22922: nonexistent LOB value
Help: https://docs.oracle.com/error-help/db/ora-22922/
No
See above
And if I change the procedure like that:
CREATE OR REPLACE procedure placeholders_replace(
p_eq_body in out clob
)
as
begin
p_eq_body := replace(p_eq_body, 'foo', 'bar');
end;
the Python code starts to work and outputs eq_body bar
as expected.
Also with oracledb
2.5.1 the original procedure (with the null
body) works.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4