2

My piece of code is as follows:

my_dsn_tns = cx_Oracle.makedsn('xyz', 1521, sid='SAMPLE')
connection = cx_Oracle.connect(user='asdasdasd', password='TIGER', dsn=my_dsn_tns)
cur = connection.cursor()
cur.execute("delete from SPS_CX_ONHAND_QTY")
connection.commit()

When I execute the following code, it does not give me any error but at the same time does not do anything. Do I need to make any changes in my code?

Farhaan Patel
  • 59
  • 1
  • 5
  • [You've asked this before](https://stackoverflow.com/q/52419971/266304). Have you checked whether there are any uncommitted changes in other sessions which are blocking the delete? [This might be helpful to check](https://stackoverflow.com/a/7502176/266304). – Alex Poole Sep 25 '18 at 16:55

1 Answers1

2

Not python related or the code you have above but generally in SQL, if you are deleting all the rows in a table you can use truncate table SPS_CX_ONHAND_QTY. This would be almost instantaneous.

demircioglu
  • 3,069
  • 1
  • 15
  • 22