This statement enables all changes to be saved to the database.
COMMIT;
This statement enables all changes to be rolled back (undo action) from the database.
ROLLBACK;
For the following statements to work, you should have another schema “USER2” in the oracle database. Otherwise, this command will fail with an error message.
You are granting all privileges like insert, delete, update etc to USER2 on table EMPLOYEE_DTL.
GRANT ALL ON EMPLOYEE_DTL TO USER2;
You are revoking all privileges like insert, delete, update etc from USER2 on table EMPLOYEE_DTL.
REVOKE ALL ON EMPLOYEE_DTL FROM USER2;
This command deletes all records permanently. You cannot rollback.
TRUNCATE TABLE EMPLOYEE_DTL;
RENAME EMPLOYEE_DTL TO EMPLOYEE_DTL_BKP;
RENAME EMPLOYEE_DTL_BKP TO EMPLOYEE_DTL;
This is not deleting the records from the database. This command clears the screen on which you are working.
CL SCR;
This command helps to save the query results executed from sql prompt to a file. After executing this command, open the file SPOOL_TABLES.TXT. You will see the results of the query.
SPOOL ON;
SPOOL D:/SPOOL_TABLES.TXT;
SELECT TABLE_NAME FROM DICT;
SPOOL OFF;
SHOW USER;
Procedures, Functions, Packages, Triggers etc are created in a file and then created on the database. To create those object, run those files, by using the following command. Here db.txt is the file name that contains the programmatical code and stored in D: drive
STA D:/db.txt;
How to switch from one schema(user1/user1@oracledb) to another schema(user2/user2@oracledb). Assume you have logged in a user1/user1@oracledb where username = user1, password = user1 and oracle instance = oracledb. After typing the following command, you will be switched to USER2 schema.
CONNECT USER2/USER2@ORACLEDB;
If you want to hide the password
connect user2@oracledb;
Oracle will prompt for password and you enter the password “user2.
If you want to comment a single line the used Double hyphens(–).
If you want to comment group of lines start with /* and end with */
E.g. — This code is used for creating table?
E.g. /* This code is used for creating table, sequences, packages, etc.
Further it provides useful information about the function of each and every program used in databases. */
Learn data modeling design Skills on OLTP and OLAP from a US University Professor with…
These SQL commands are related with Oracle's data dictionary and can be used to get…
In this section, we will try to explain about important database DROP commands that are…
In this section, we will try to explain about important database DML commands that are…
In this section, we will try to explain about important database ALTER commands that are…
An Oracle database consists of DDL commands, which are useful to create, modify and drop…