Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between DDL statements and transactions between Oracle and PostgreSQL

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is the difference between DDL statements and transactions between Oracle and PostgreSQL". In daily operation, I believe that many people have doubts about the difference between DDL statements and transactions between Oracle and PostgreSQL. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "what is the difference between DDL statements and transactions between Oracle and PostgreSQL?" Next, please follow the editor to study!

When Oracle executes DDL statements such as CREATE, DROP, RENAME, or ALTER, the transaction is committed implicitly; when PG executes such statements, the transaction is not committed, it needs to be committed explicitly.

-- Session A

Drop table if exists t1

-- start a transaction

Begin

-- query the current transaction number

Select txid_current ()

-- create a table & insert 100w data

Create table T1 (id int,c1 varchar (20))

-- query the current transaction number

Select txid_current ()

Insert into T1 select generate_series (1JI 1000000),'# TESTDATA#'

Rollback;-- rollback transaction

Select count (*) from T1

Tip:

ERROR: relation "T1" does not exist

LINE 1: select count (*) from T1

If it is an Oracle database, the transaction will be implicitly committed after the data table is created successfully, the data will be inserted and rolled back, and the data table will still exist.

At this point, the study on "what is the difference between DDL statements and transactions between Oracle and PostgreSQL" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report