python-oracledb
python-oracledb copied to clipboard
cursor execute raise no_data_found without any exceptions
Python 3.12.2 python-oracledb 2.1.1 Oracle 19.3.0.0.0 When cursor execute pl/sql block that raise no_data_found nothing happened.
import oracledb
conn = oracledb.connect("user", "password", "server")
cursor = conn.cursor()
-- no exception!
cursor.execute("begin raise no_data_found; end;")
-- exception
cursor.execute("begin raise CURSOR_ALREADY_OPEN; end;")
-- exception
cursor.execute("begin raise_application_error(-20000, 'user exception'); end;")
Maybe that's because sqlcode of no_data_found > 0. P.S. cx_oracle 8.3.0 will raise exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: ORA-01403: no data found
ORA-06512: at line 1
python-oracledb Thick mode also raises the exception.
I have pushed a patch that corrects this issue. If you are able to build from source you can verify that it works for you, too.
This was included in version 2.1.2 which was just released.