Posted by : Akshay Patil Tuesday, 24 March 2015

There are 4 types of SQL commands or statements in oracle as given below :
DDL
Data Definition Language (DDL) statements are used to define the database structure or schema. 
Some examples:
CREATE - to create objects like Table,Views,Sequences,Indexes,Synonyms etc. in the database
ALTER - alters the structure of the database
DROP - delete objects like Table,Views,Sequences,Indexes,Synonyms etc. 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 accessing and managing data within relational database tables. 
Some examples:
SELECT - retrieve data from the a database tables
INSERT - insert data into a table
UPDATE - updates existing data within a table
DELETE - deletes specific or 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 are used to control privileges in database.
To perform any operation in database such as creating tables,views or perform insert,delete to table we need privileges.
Some examples:
GRANT - gives user's access privileges to database
REVOKE - withdraw access privileges given with the GRANT command

The operations for which privileges may be granted to or revoked from a user or role may include CONNECT, SELECT, INSERT, UPDATE, DELETE, EXECUTE, and USAGE.
In the Oracle database, executing a DCL command issues an implicit commit. Hence you cannot roll back the command.


TCL
Transaction Control Language (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 or return
ROLLBACK - restore database to original since the last COMMIT
SET TRANSACTION - Change transaction options like isolation level and what rollback segment to use

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Study Basics

Oracle APEX Oracle SQL Oracle PL/SQL

Popular Post

Blogger templates

Total Pageviews

Powered by Blogger.

Unordered List

Follow us on Facebook!

- Copyright © TechnicalBits -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -