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
cx_Oracle hides NO_DATA_FOUND exception in an INSERT statement with RETURNING clause. Please find below example that should raise NO_DATA_FOUND exception:
importcx_Oracleconnection=cx_Oracle.connect("user", "password", "TNS")
cursor=connection.cursor()
cursor.execute(''' CREATE TABLE "ISSUE_TEST" ( "ID" NUMBER(11) GENERATED BY DEFAULT ON NULL AS IDENTITY, "TEST_CHAR" VARCHAR2(10) )''')
cursor.execute(''' CREATE OR REPLACE TRIGGER "TRG_NO_DATA_FOUND" AFTER INSERT ON "ISSUE_TEST" FOR EACH ROW BEGIN RAISE NO_DATA_FOUND; END;''')
v_id=Nonecursor.execute(''' INSERT INTO "ISSUE_TEST"("TEST_CHAR") VALUES('XYZ') RETURNING "ISSUE_TEST"."ID" INTO :v_id''', {'v_id': v_id})
Other exceptions e.g. DUP_VAL_ON_INDEX, ZERO_DIVIDE, TOO_MANY_ROWS are raised properly.