Database Programming with PL/SQL
Assignment-1
UNIT-1
1. Explain the block structure of a PL/SQL program. What are the different sections of a
block, and what role does each play in the execution of a PL/SQL program? Use a
detailed example to illustrate your explanation.
2. Describe the scope and lifetime of variables in nested PL/SQL blocks. How does
variable shadowing work in PL/SQL? Explain with an example.
3. Discuss the scalar and composite data types available in PL/SQL. How do you decide
whether to use a scalar type, record, or collection in a given scenario? Provide examples
for each type to support your discussion.
4. How can you propagate exceptions in PL/SQL to the calling block or program? Discuss
the benefits and risks of exception propagation with examples.
5. Compare and contrast functions and procedures in PL/SQL. When should you use a
function instead of a procedure and vice versa? Provide examples of both.
UNIT-2
1. Explain the lexical units in PL/SQL, including identifiers, literals, delimiters, and
comments. How do they contribute to the structure and readability of PL/SQL code?
Provide examples to illustrate each type of lexical unit.
2. Explain how nesting conditional statements works in PL/SQL. What are some common
pitfalls of using deeply nested conditions, and how can they be avoided? Illustrate with
an example.
3. What are cursors in PL/SQL? Differentiate between implicit and explicit cursors,
explaining when and why each type should be used. Provide detailed examples of both
types.
4. Discuss the challenges and potential pitfalls of using bulk statements in PL/SQL. How
can exceptions be managed effectively in bulk operations? Use examples to support
your discussion.
5. How can the Oracle Collection API be used to perform advanced operations on
collections, such as searching, sorting, or aggregating data? Illustrate your explanation
with examples.