PL/SQL Interview Questions with Answers Page IV


From freshersonline.com

Jump to: navigation, search

Interview Question Home


1. Which system tables contain information on privileges granted and privileges obtained?

USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD


2. Which system table contains information on constraints on all the tables created?obtained?

USER_CONSTRAINTS.


3. What is the difference between TRUNCATE and DELETE commands?

TRUNCATE is a DDL command whereas DELETE is a DML command. Hence DELETE operation can be rolled back, but TRUNCATE

operation cannot be rolled back. WHERE clause can be used with DELETE and not with TRUNCATE.


4. State true or false. !=, <>, ^= all denote the same operation?

True.


5. State true or false. EXISTS, SOME, ANY are operators in SQL?

True.


6. What will be the output of the following query?

SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'), 'AN', '**'),'*','TROUBLE') FROM DUAL;?

TROUBLETHETROUBLE. p>


7. What does the following query do?

SELECT SAL + NVL(COMM,0) FROM EMP;?

This displays the total salary of all employees. The null values in the commission column will be replaced by 0 and added to salary.


8. What is the advantage of specifying WITH GRANT OPTION in the GRANT command?

The privilege receiver can further grant the privileges he/she has obtained from the owner to any other user.


9. Which command executes the contents of a specified file?

START or @.


10. What is the value of comm and sal after executing the following query if the initial value of ‘sal’ is 10000

UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;?

sal = 11000, comm = 1000.


11. Which command displays the SQL command in the SQL buffer, and then executes it?

RUN.


12. What command is used to get back the privileges offered by the GRANT command?

REVOKE.


13. Which date function is used to find the difference between two dates?

MONTHS_BETWEEN.


14. What operator performs pattern matching?

LIKE operator.


15. What is the use of the DROP option in the ALTER TABLE command?

It is used to drop constraints specified on the table.


16. What operator tests column for the absence of data?

IS NULL operator.


17. What are the privileges that can be granted on a table by a user to others?

Insert, update, delete, select, references, index, execute, alter, all.


18. Which function is used to find the largest integer less than or equal to a specific value?

FLOOR.


19. Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?

Data Definition Language (DDL).


20. What is the use of DESC in SQL?

DESC has two purposes. It is used to describe a schema as well as to retrieve rows from table in descending order.

Explanation :

The query SELECT * FROM EMP ORDER BY ENAME DESC will display the output sorted on ENAME in descending order.

Personal tools