19.2 Declarative Programming in PL/SQLWhen you call a PLVexc exception handler, you shift from a procedural to a declarative style of programming in PL/SQL . To understand what I mean, think about the SQL language. You do not write programs in SQL . Instead, you use a declarative syntax to describe the set of data you want to see or modify. The underlying SQL engine then figures out the best way to accomplish the task. This declarative or "set at a time" mode of processing is a critical element of the power of the SQL language. PL/SQL is very different from SQL . It is a procedural programming language. When you want to get something done in PL/SQL , you write a program. This gives you a tremendous amount of control, but it definitely cuts into your productivity -- and offers many over-ripe opportunities for introducing bugs into your code. Wouldn't it be wonderful to combine the control of the procedural language with the high-level abstraction and productivity of a declarative syntax? Well, we are not talking idle chatter here. We are talking packages. Constructed properly, the PL/SQL package offers the opportunity for developers to write code in a declarative style. Take a look again at the exception section that utilizes PLVexc. To write this code, a user of PLVexc only had to know what kind of action she wanted to perform. Ignore the error? Record and continue? Record and halt? Just describe the action desired, pass the necessary data, and then let the underlying engine (the PLVexc package) figure out how to implement your request. Declarative coding in PL/SQL ! Keep these concepts in mind as you read the chapters in Part V. Copyright (c) 2000 O'Reilly & Associates. All rights reserved. |
|