What is the difference between DDL statements and transactions between Oracle and PostgreSQL
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!