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 it may be caused by inconsistent data on both sides. But why is the inconsistency? Instead, I did not use commit. I checked it on the Internet, and I probably said 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 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 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