When Does Oracle need commit?

Source: Internet
Author: User
Today, oracle's SQLplus performed the delete and query operations, and then the query operation was also executed in PLSQL. The results were different in the same statement, which made me very depressed.

Today, oracle SQL plus performed the delete and query operations, and then the query operation was also performed in PL/SQL. The results were different when the statements were the same, which made me very depressed.

Today, Oracle SQL plus performed the delete and query operations and then the query operations in PL/SQL. The results of the same statements were different, which made me feel quite depressed, later, I suddenly thought that the data on both sides may be inconsistent, but why is it inconsistent? It means no use of commit,

I checked it on the Internet, which is probably like this:

DML language, such as update, delete, insert, and so on, to modify data in a table, commit;
If the DDL language, such as create or drop, changes the table structure, you do not need to write commit (because commit is hidden internally );

DDL data definition language:
Create table
Alter table
Drop table delete table
Truncate table delete all rows in the table
Create index
Drop index Delete index
When a DDL statement is executed, oracle submits the current transaction before and after each statement. If you use the insert command to insert records into the database, a DDL Statement (such as create
In this case, data from the insert command will be submitted to the database. After a DDL statement is executed, it is automatically submitted and cannot be rolled back.

DML data operation language:
Insert inserts records into the database
Update and modify Database records
Delete database records
If the DML command is not submitted, it will not be seen by other sessions. Unless the DDL or DCL command is executed after the DML command, or the user exits the session or terminates the instance, the system automatically
Issue the commit command to submit unsubmitted DML commands.


DDL:
Data Definition Language (DDL) statements are used to define the database structure or schema. Some examples:
CREATE-to create objects in the database
ALTER-alters the structure of the database
DROP-delete objects from the database
TRUNCATE-remove all records from a table, including all spaces allocated for the records are removed
COMMENT-add comments to the data dictionary
RENAME-rename an object

DML:
Data Manipulation Language (DML) statements are used for managing data within schema objects. Some examples:
SELECT-retrieve data from the database
INSERT-insert data into a table
UPDATE-updates existing data within a table
DELETE-deletes all records from a table, the space for the records remain
MERGE-UPSERT operation (insert or update)
CALL-call a PL/SQL or Java subprogram
Explain plan-explain access path to data
Lock table-control concurrency

DCL
Data Control Language (DCL) statements. Some examples:
GRANT-gives user's access privileges to database
REVOKE-withdraw access privileges given with the GRANT command

TCL
Transaction Control (TCL) statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions.
COMMIT-save work done
SAVEPOINT-identify a point in a transaction to which you can later roll back
ROLLBACK-restore database to original since the last COMMIT
Set transaction-Change transaction options like isolation level and what rollback segment to use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.