Computeristic
Computeristic

Reputation: 105

ORACLE - tables

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?

Upvotes: 2

Views: 259

Answers (4)

Ryan McGeary
Ryan McGeary

Reputation: 239924

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.

Upvotes: 7

JosephStyons
JosephStyons

Reputation: 58685

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.

Upvotes: 1

OMG Ponies
OMG Ponies

Reputation: 332581

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

Upvotes: 4

MindStalker
MindStalker

Reputation: 14864

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.

Upvotes: 0

Related Questions