Declaring exceptions - user-defined exceptions, PL-SQL Programming

Declaring Exceptions

The Exceptions can be declared only in the declarative part of the PL/SQL subprogram, block, or package. By introducing its name, you can declare an exception followed by the keyword EXCEPTION. In the illustration below, you declare an exception named past_due:

DECLARE

past_due EXCEPTION;

The Exception and variable declarations are alike. But keep in mind that, an exception is an error condition, not a data item. Unlike variables, the exceptions cannot appear in the assignment statements or the SQL statements. Though, the same scope rules apply to the variables and exceptions.

Posted Date: 10/5/2012 5:11:13 AM | Location : United States







Related Discussions:- Declaring exceptions - user-defined exceptions, Assignment Help, Ask Question on Declaring exceptions - user-defined exceptions, Get Answer, Expert's Help, Declaring exceptions - user-defined exceptions Discussions

Write discussion on Declaring exceptions - user-defined exceptions
Your posts are moderated
Related Questions
Literature review

Adding Table Constraints ALTER TABLE ENROLMENT ADD CONSTRAINT NameNotNull CHECK (Name IS NOT NULL) ; ALTER TABLE ENROLMENT ADD CONSTRAINT PK_StudentId_CourseId PRIM

Using %TYPE The %TYPE attribute gives the datatype of a variable or the database column. In the example below, the %TYPE gives the datatype of a variable: credit REAL(7,2); debi

V ariables and Constants in PL/SQL The PL/SQL permits you to declare constants and variables, and then use them in SQL and procedural statements anywhere in the expression. Th

Iterative Control: LOOP  Statements The LOOP statement executes a series of statements multiple times. There are 3 forms of LOOP statements: LOOP, WHILE-LOOP, & FOR-LOOP. LOOP

Benefit of the dynamic SQL: This part shows you how to take full benefit of the dynamic SQL and how to keep away from some of the common pitfalls. Passing the Names of Sc

Explicit Cursors The set of rows returned by the query can include zero, one, or multiple rows, depending on how many rows meet your search criteria. Whenever a query returns

Example of Tables within a Table - SQL Example: Obtaining C_ER from COURSE and EXAM_MARK SELECT CourseId, CAST (TABLE (SELECT DISTINCT StudentId, Mark FROM EXAM_MARK AS EM

Data Types in SQL - Timestamp TIMESTAMP for values representing points in time on a specified uniform scale. DATE is used for timestamps on a scale of one day, such as DATE '2

Using the BULK COLLECT Clause The keywords BULK COLLECT specify the SQL engine to bulk-bind output collections before returning them to the PL/SQL engine. You can use these ke