question

OracleApprender avatar image
OracleApprender asked

Insert a row to a table and create another table then say Rollback. Will the row be inserted ?

If you insert a row in a table, then create another table and then say Rollback.In this case will the row be inserted ? Thank you in advance.

queryoracledatabasetransaction
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KillerDBA avatar image
KillerDBA answered

According to all the documentation I've read, yes. And that is how it works for me. Any DDL statement does a commit. Any work pending is committed.

Have you tried this and found it does't work as advertised?

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

OracleApprender avatar image OracleApprender commented ·
Thanks for the answer. Yes..I'm seeing that row is inserted into the table. But the new table is not created.
0 Likes 0 ·
KillerDBA avatar image KillerDBA commented ·
You should post a script showing the situation that isn't working for you.
0 Likes 0 ·
HillbillyToad avatar image
HillbillyToad answered

DDL always implicitly commits. That's why TRUNCATE can't be undone with a ROLLBACK, b/c it's a DDL vs DML statement.

Some tools use separate sessions to issue/execute commands, so it's possible your INSERT and CREATE are happening in different sessions. Tools that are 'threaded' generally work this way. Applications like SQL*Plus wouldn't exhibit that behavior.

In either case, you should commit or rollback a table change as soon as you make up your mind and definitely before you go do maint work in the system - or at least open up another command-window so you have a dedicated session.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.