From 483cc1c430e038d7d16342f76761d18b989c3eed Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Sat, 28 Apr 2018 19:39:45 +0200 Subject: [PATCH] Refs #28859 -- Fixed "no data found" exception handling with cx_Oracle 6.3+. --- django/db/backends/oracle/operations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index 9e410ad810..923b5d118d 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -223,7 +223,8 @@ END; def fetch_returned_insert_id(self, cursor): try: return int(cursor._insert_id_var.getvalue()) - except TypeError: + except (IndexError, TypeError): + # cx_Oracle < 6.3 returns None, >= 6.3 raises IndexError. raise DatabaseError( 'The database did not return a new row id. Probably "ORA-1403: ' 'no data found" was raised internally but was hidden by the '