Unit 5: Pl-SQL - Subjective Questions

CAP570 — Advanced Database Techniques • Practice Questions with Detailed Answers

20 questions

1

Define PL/SQL and explain its relationship with SQL.

2

Explain the need for PL/SQL in database application development.

3

Distinguish between SQL and PL/SQL.

4

Describe the basic structure of a PL/SQL block with suitable syntax.

5

Which sections of a PL/SQL block are mandatory and which are optional? Explain the purpose of each section.

6

Write and explain a simple PL/SQL block that declares two numbers, calculates their sum, and displays the result.

7

Explain the block-structured nature of PL/SQL and the concept of nested blocks.

8

Discuss the major benefits of using PL/SQL.

9

How does PL/SQL improve application performance and reduce network traffic?

10

Explain the role of the PL/SQL engine and SQL engine during the execution of a PL/SQL block.

11

Describe the categories of PL/SQL blocks and distinguish between anonymous and named blocks.

12

Explain how variables and constants are declared and used in a PL/SQL block.

13

What are %TYPE and %ROWTYPE attributes? Explain their advantages with examples.

14

Explain executable statements and assignment statements in PL/SQL with examples.

15

Describe how SQL statements are embedded in PL/SQL. Illustrate your answer using SELECT INTO and an UPDATE statement.

16

What is exception handling in PL/SQL? Explain its basic structure and importance.

17

Write a PL/SQL block that handles division by zero and explain its flow of execution.

18

Discuss modularity, maintainability, and reusability as features of PL/SQL.

19

Explain how PL/SQL contributes to database security and data integrity.

20

Construct and explain a complete PL/SQL block that retrieves an employee's salary, calculates a bonus, updates the salary, displays the result, and handles possible errors.