DML Statements

In this page we have a list of PL/SQL Data Manipulation Language (DML) statements that you can use as a small introduction to dml statements.

DML or Data Manipulation Language statements are used to manipulate data in a database. There are four types of DML statements: INSERT, UPDATE, DELETE, and MERGE.

INSERT statement is used to insert new rows into a table. The INSERT statement has the following syntax:

INSERT INTO table (column1, column2,...) 
VALUES (value1, value2,...);

UPDATE statement is used to modify existing rows in a table. The UPDATE statement has the following syntax:

UPDATE table 
SET column1 = value1, column2 = value2 
WHERE condition;

DELETE statement is used to delete rows from a table. The DELETE statement has the following syntax:

DELETE FROM table WHERE condition;

MERGE statement is used to merge two or more rows into one row. The syntax for the MERGE statement is as follows:

MERGE INTO table1
USING table2
ON (condition)
WHEN MATCHED THEN 
UPDATE SET column1 = value1, column2 = value2 
WHEN NOT MATCHED THEN 
INSERT (column1, column2,...) 
VALUES (value1, value2, ...) ;

DML statements can be used in transactions. A transaction is a group of SQL statements that are executed together as a single unit. Transactions ensure that the data in the database is consistent and accurate.