You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There needs to be a condition that checks if it is null and then avoids performing this max size check, for example:
if value is not None and max_size > 0:
if isinstance(value, str):
actual_size[0] = len((<str> value).encode())
else:
actual_size[0] = len(<bytes> value)
if actual_size[0] > max_size:
violated[0] = True
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/app-root/lib/python3.12/site-packages/oracledb/dbobject.py", line 60, in __setattr__
self._impl.set_attr_value(attr_impl, value)
File "src/oracledb/impl/base/dbobject.pyx", line 123, in oracledb.base_impl.BaseDbObjectImpl.set_attr_value
File "src/oracledb/impl/base/dbobject.pyx", line 44, in oracledb.base_impl.BaseDbObjectImpl._check_max_size
TypeError: object of type 'NoneType' has no len()
Cut and paste text showing the command you ran. No screenshots.
Here is the PLSQL to create the record:
create or replace package foo_pkg
is
type r_bar IS RECORD (baz varchar2(10));
end foo_pkg;
/
create or replace package body foo_pkg
is
end foo_pkg;
/
Here is the python that creates an instance of the record type and set BAZ to null:
r_foo_type = conn.gettype('MY_SCHEMA.FOO_PKG.R_BAR')
r_foo = r_foo_type.newobject()
# This is OK, as expected
r_foo.BAZ = 'hi'
# Setting to NULL results in an error:
r_foo.BAZ = None
Here is the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/app-root/lib/python3.12/site-packages/oracledb/dbobject.py", line 60, in __setattr__
self._impl.set_attr_value(attr_impl, value)
File "src/oracledb/impl/base/dbobject.pyx", line 123, in oracledb.base_impl.BaseDbObjectImpl.set_attr_value
File "src/oracledb/impl/base/dbobject.pyx", line 44, in oracledb.base_impl.BaseDbObjectImpl._check_max_size
TypeError: object of type 'NoneType' has no len()
Does your application call init_oracle_client()?
Yes, thick mode.
This tells us whether you are using the python-oracledb Thin or Thick mode.
The text was updated successfully, but these errors were encountered:
In 2.0 it is no longer possible to set an attribute on DbObject to NULL for a VARCHAR2.
This was possible in all previous versions of oracledb as well as cx_Oracle.
This bug was caused by the following change:
8211232
The change assumes that the value is not null.
There needs to be a condition that checks if it is null and then avoids performing this max size check, for example:
2.0
Give your database version.
19C
Also run Python and show the output of:
And:
error
Cut and paste text showing the command you ran. No screenshots.
Here is the PLSQL to create the record:
Here is the python that creates an instance of the record type and set
BAZ
to null:Here is the error:
Yes, thick mode.
This tells us whether you are using the python-oracledb Thin or Thick mode.
The text was updated successfully, but these errors were encountered: