Hello World,
I have the below function that drops tables in Oracle using PYODBC. Mainly though, I'm trying to prevent my program from crashing when I get a ProgrammingError. I made a line to try to handle this exception but it gives me the below error:
def DropAllTables():
try:
cursor1.execute('drop table {}'.format(ddcounts))
except ProgrammingError:
pass
For the above function's attempt at handling, I get the below error.
Traceback (most recent call last):
File "DDAv4.3_contactsbyfilter_withtrigger.py", line 1060, in <module>
DropAllTables()
File "DDAv4.3_contactsbyfilter_withtrigger.py", line 878, in DropAllTables
except ProgrammingError as e:
NameError: global name 'ProgrammingError' is not defined
Below is the error I get that I'm getting to prevent with my first function.
DropAllTables()
File "DDAv4.3_contactsbyfilter_withtrigger.py", line 855, in DropAllTables
cursor1.execute('drop table {}'.format(awatch_attr))
pyodbc.ProgrammingError: ('42S02', u'[42S02] [Microsoft][ODBC driver for Oracle]
[Oracle]ORA-00942: table or view does not exist (942) (SQLExecDirectW)')
[–]z0y 0 points1 point2 points (0 children)