1. What is the difference between a procedure and a function?
Procedure: Performs an action but doesn't return a value.
Function: Returns a single value and can be used in SQL expressions.
2. What parameters can we pass in a procedure and a function?
IN (input), OUT (output), IN OUT (both input and output). Functions typically use only IN parameters.
3. Can we write DML operations in a procedure and a function?
Yes, but functions should not modify the database state if called in SQL statements. Procedures can
freely use DML.
4. How do you call a function outside a shell?
By using: SELECT function_name(parameters) FROM dual;
5. What is a cursor attribute?
Built-in attributes that provide information about cursor state: %FOUND, %NOTFOUND,
%ROWCOUNT, %ISOPEN.
6. What is an index?
An index improves the speed of data retrieval operations on a table.
7. How many types of indexes are there?
Common types: B-tree, Bitmap, Unique, Composite, Function-based, Reverse key.
8. What is a bitmap index?
Uses bitmaps; ideal for columns with low cardinality (e.g., gender).
9. What is a B-tree index?
A balanced tree structure; best for high-cardinality columns.
10. What is a trigger?
A stored procedure that runs automatically in response to certain table/view events (INSERT,
UPDATE, DELETE).
11. What is an 'INSTEAD OF' trigger?
A trigger used on views to allow DML operations that are otherwise not directly allowed.
12. What is a mutation trigger?
An error when a trigger queries/modifies the table it's triggered on.
13. How do you handle NULL values in a column?
Use functions like NVL(), COALESCE(), or conditional logic to replace or handle NULLs.
14. What is the NVL function?
NVL(expr1, expr2) returns expr2 if expr1 is NULL.
15. What are NVL tools?
Likely refers to NVL, NVL2, COALESCE, and NULLIF functions.
16. Have you used CASE statements?
Yes, used for conditional logic in SQL.
Example: CASE WHEN condition THEN result ELSE default END
17. What is the difference between CASE and DECODE?
CASE supports conditions and multiple data types; DECODE is simpler and limited to equality
checks.
18. Can we use both DECODE and CASE in PL/SQL?
Yes, both are supported.