Advanced Oracle PL/SQL Programming with Packages

Advanced Oracle PL/SQL Programming with PackagesSearch this book
Previous: 19.1 About Plug-and-PlayChapter 19
PLVdyn and PLVfk: Dynamic SQL and PL/SQL
Next: 19.3 The Dynamic Packages of PL/Vision
 

19.2 Declarative Programming in PL/SQL

When 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.


Previous: 19.1 About Plug-and-PlayAdvanced Oracle PL/SQL Programming with PackagesNext: 19.3 The Dynamic Packages of PL/Vision
19.1 About Plug-and-PlayBook Index19.3 The Dynamic Packages of PL/Vision

The Oracle Library Navigation

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference
This HTML Help has been published using the chm2web software.