tags:

views:

91

answers:

4
+2  Q: 

ORACLE - tables

Hi,

After entering code to create a new table in SQL ORACLE, would the changes be saved if I was to log out of the SQL Session?

+6  A: 

Yes, your table definitions are saved; Oracle DDL has an implicit transaction*. Other databases, such as PostrgreSQL, do have transactional DDL, but with Oracle, it is automatic, so be careful.

* Oracle Transaction Management: If the current transaction contains any DML statements, Oracle first commits the transaction, and then runs and commits the DDL statement as a new, single statement transaction.

Ryan McGeary
A: 

Umm, what? Yes all changes to Data and Table structures are immediately saved (unless part of a transaction, which waits till the end of the transaction to permanently save) The things that are dependent upon your Session are session variables and session settings.

MindStalker
Oracle DDL statements are always there own transactions. They can not be part of a larger transaction that is latter commited or rolled back.
Shannon Severance
+3  A: 

The correct answer is that Oracle DDL uses an implicit transaction - there's no opportunity to the transaction back, it's immediately committed.

OMG Ponies
There's no opportunity to roll the transaction back.
OMG Ponies
A: 

In short, "yes". DDL statements are committed immediately after execution. If your script also includes INSERT statements to populate those tables, then those would not be saved without a commit of their own.

JosephStyons