Database [PCS Infotech Placement]: Sample Questions 22 - 23 of 25

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 22




Can a inbuilt exception be redefined by a user?




Inbuilt exceptions cannot be redefined by a user

  • PL/SQL exceptions can be predefined and raised automatically by oracle engine on error.
  • Every error defines a unique number and message.
  • When error occurs, exceptions contain information about the error.

Types of Exception

  • PL/SQL inbuilt exception- eg. , division by zero (ZERO_DIVIDE) , out of memory (STORAGE_ERROR) .
  • Users can make user define exception.

Question 23


Describe in Detail


When a subprogram is to be declared within a procedure?


  • A subprogram creates a PL/SQL nested block created at declaration time within a procedure.
  • Can declare it first and then define it later in the same block.
  • A nested subprogram is stored in the database- nested in a packaged subprogram.
  • Subprogram created inside a package is a package subprogram.
  • Store in database until package is dropped with the DROP PACKAGE statement.
  • Procedure can perform an action or it could be a function to compute and return a value.

Reasons to use subprogram:

  • Modularity
  • Easier design
  • Maintainability
  • Packageability
  • Reusability
  • Better Performance

Developed by: