python-oracledb icon indicating copy to clipboard operation
python-oracledb copied to clipboard

cursor execute raise no_data_found without any exceptions

Open Gepar opened this issue 10 months ago • 2 comments

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

Gepar avatar Apr 05 '24 12:04 Gepar

python-oracledb Thick mode also raises the exception.

cjbj avatar Apr 05 '24 14:04 cjbj

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.

anthony-tuininga avatar Apr 09 '24 22:04 anthony-tuininga

This was included in version 2.1.2 which was just released.

anthony-tuininga avatar Apr 11 '24 19:04 anthony-tuininga