Database [PCS Infotech Placement]: Sample Questions 1 - 2 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 1

Database
Edit

Question

Fill-Blanks▾

PRAGMA_EXCEPTION_INIT (message, code no) ________exceptions are executed at.

Answer

Explanation

Pragma exception_INIT
  • The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error.
  • Pragma exception_init allows replacing oracle message by user defined messages.
  • Instructs compiler to associate the specific message to oracle predefined message at compile time.
  • Provides an error message with a specific oracle error.
  • For example, PRAGMA EXCEPTION_INIT (exception name, oracle error number) .

    PRAGMA

  • PRAGMA keyword signifies the statements is a compiler directive.
  • It is not processed when the PL/SQL block is executed.

    Syntax

  • PRAGMA EXCEPTION_INT (exception, error_number) ;

Question 2

Database
Edit

Statement

True-False▾

NO_DATA_FOUND (exception) gives the same result.

Answer

TRUE

Explanation

Define Exception Handlar
  • PL/SQL provides many pre-defined exceptions executed when database rule is violated.
  • Predefined exception NO_DATA_FOUND means a SELECT INTO statement returns no rows:
    • Single row select returned no rows
    • Program referenced a deleted table
    • Program referenced uninitialized element in an associative array.
  • SELECT returns value if one is available, and “NULL” instead of a NO_DATA_FOUND exception.
  • NO_DATA_FOUND is captured in the EXCEPTION block.
  • Exceptions are not only raised by the server on internal database error, but also raised by RAISE command.

Developed by: