Insert, Update, Delete in Oracle
Harry
· 11 Sep 2026
· 10 views
Inserting Data
INSERT INTO customers (name, email, city) VALUES
('Priya Sharma', 'priya@example.com', 'Mumbai');
INSERT INTO customers (name, email, city) VALUES
('Rahul Patel', 'rahul@example.com', NULL);
COMMIT;Why COMMIT Matters
Oracle is transactional. Changes are invisible to other sessions until you run COMMIT, and you can undo them with ROLLBACK before that.
Updating
UPDATE customers SET city = 'Pune' WHERE id = 1;
COMMIT;Deleting Rows
DELETE FROM customers WHERE id = 3;
COMMIT;Insert-Or-Update With MERGE
MERGE INTO customers c
USING (SELECT 1 AS id, 'Priya' AS name, 'priya@example.com' AS email FROM dual) s
ON (c.email = s.email)
WHEN MATCHED THEN UPDATE SET c.name = s.name
WHEN NOT MATCHED THEN INSERT (name, email) VALUES (s.name, s.email);Key Points
- INSERT, UPDATE and DELETE change data.
- COMMIT makes changes permanent; ROLLBACK undoes them.
- MERGE performs insert-or-update in one statement.
- dual is a one-row dummy table used for expressions.