Burt Reynolds
Burt Reynolds

Reputation: 31

cx_oracle executes without error, but does not delete data

I would to remove all customers who's names begin with SCH from my database. When I execute the code below it runs without error, but does not remove the data from the database.

cur = db.cursor()
sql = "DELETE FROM customers where IMAGE_ID like 'SCH%'"
cur.execute(sql)

Upvotes: 0

Views: 687

Answers (1)

Tigran Shahnazaryan
Tigran Shahnazaryan

Reputation: 46

after delete you need commit

conn = cx_Oracle.connect(...)
cur = db.cursor()
sql = "DELETE FROM customers where IMAGE_ID like 'SCH%'"
cur.execute(sql)
conn.commit()
cur.close()
conn.close()

Upvotes: 3

Related Questions