Database-MySQL [3i Infotech Placement]: Sample Questions 155 - 156 of 162

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 155

Edit

Describe in Detail

Essay▾

What are the unary operations in Relational Algebra?

Explanation

  • Projection: Is used to project required column data from a relation.
Understanding of Projection
  • Selection: Is used to select required tuples of the relations.
Understanding of Selection
  • Join: Concatenation of rows from one relation and related rows from another.

Question 156

Edit

Describe in Detail

Essay▾

Talk about “Exception Handling” in PL/SQL?

Explanation

  • PL/SQL provides a feature to handle the Exceptions which occur in a PL/SQL Block known as exception Handling.
  • Using Exception Handling, we can test the code and avoid it from exiting abruptly.

Structure of Exception Handling.

DECLARE

Declaration section

BEGIN

Exception section

EXCEPTION

WHEN ex_name1 THEN

-Error handling statements

WHEN ex_name2 THEN

-Error handling statements

WHEN Others THEN

-Error handling statements

END;

Types of Exception.

There are 3 types of Exceptions.

(a) Named System Exceptions

(b) Unnamed System Exceptions

(c) User-defined Exceptions

(a) Named System Exceptions:

  • System exceptions are automatically raised by Oracle, when a program violates a RDBMS rule.
  • There are some system exceptions, which are raised frequently, so they are pre-defined and given a name in Oracle, which are known as Named System Exceptions.

(b) Unnamed System Exceptions:

  • Those system exceptions for which oracle does not provide a name are known as unnamed system exception.
  • These exceptions do not occur frequently.
  • These Exceptions have a code and an associated message.

    There are two ways to handle unnamed system exceptions:

    • By using the WHEN OTHERS exception handler, or
    • By associating the exception code to a name and using it as a named exception.

(c) User-defined Exceptions:

  • Apart from system exceptions, we can explicitly define exceptions based on business rules.
  • These are known as user-defined exceptions.

Developed by: