What are some predefined exceptions in PL/SQL?

A list of predefined exceptions in PL/SQL: DUP_VAL_ON_INDEX ZERO_DIVIDE NO_DATA_FOUND TOO_MANY_ROWS CURSOR_ALREADY_OPEN INVALID_NUMBER INVALID_CURSOR PROGRAM_ERROR TIMEOUT _ON_RESOURCE STORAGE_ERROR LOGON_DENIED VALUE_ERROR In PL/SQL, predefined exceptions are built-in exceptions provided by Oracle that handle common error conditions. Some of the commonly used predefined exceptions in PL/SQL include: NO_DATA_FOUND: Raised when a SELECT INTO statement returns no rows. … Read more

How do you declare a user-defined exception?

You can declare the User defined exceptions under the DECLARE section, with the keyword EXCEPTION. Syntax: EXCEPTION; In PL/SQL, you can declare a user-defined exception using the following syntax: DECLARE exception_name EXCEPTION; — other declarations and statements BEGIN — your code here RAISE exception_name; EXCEPTION WHEN exception_name THEN — handle the exception DBMS_OUTPUT.PUT_LINE(‘Custom exception handled’); … Read more

What are PL/SQL exceptions? Tell me any three

Too_many_rows No_Data_Found Value_error Zero_error etc. In PL/SQL (Procedural Language/Structured Query Language), exceptions are events that occur during the execution of a block of code that disrupts the normal flow of the program. PL/SQL provides a way to handle these exceptions through the use of exception handling mechanisms. Here are three types of PL/SQL exceptions: NO_DATA_FOUND: … Read more

What is the main reason behind using an index?

Faster access of data blocks in the table. The main reason for using an index in PL/SQL (and in databases in general) is to improve the performance of query operations. Indexes provide a quick and efficient way to locate rows in a table based on the values in one or more columns. They act like … Read more

How exception is different from error?

Whenever an Error occurs Exception arises. Error is a bug whereas exception is a warning or error condition. In PL/SQL, an exception and an error are related concepts but have distinct meanings: Error: An error generally refers to any unexpected or undesirable event that occurs during the execution of a program. Errors can be of … Read more