0
How to undo an sql statement?
2 Antworten
+ 7
You need to learn the concept of transactions.
First of, before doing work, you can set a savepoint, remember it wont be saved, its just a point.
savepoint s1;
Later do some work, and if you like you can save it using :-
commit; or commit s1;
If you want to undo,
rollback to savepoint s1;
NOTE :- You need to start a transaction first,use
begin;
Also, if you do a thing, any random code, it automatically gets saved.Thats because autocommit is "on" by default. Use this :-
set autocommit = false;
(I DONT KNOW THE EXACT LINES, YOU CAN GOOGLE THEM)
+ 1
do an other SQL statement.
in other words, you cant undo drop tables.