Database Reference
In-Depth Information
PL/SQL extends SQL with programming controls and features such as
procedures, variables, and control structures. Let's begin the meat of this
chapter by asking: Why is PL/SQL classified as a programming language?
24.2
Why Is PL/SQL a Programming Language?
PL/SQL is a programming language because, unlike SQL, it allows depen-
dencies to exist between multiple SQL commands, within the same block
of code. In Oracle SQL, each SQL statement cannot pass a result on to
another SQL statement or control structure, but PL/SQL can. Also, per-
haps more important, a programming language block structure allows one
procedure to call another, allowing for a modular, compartmentalized, or
perhaps even pseudo-object hierarchical programming structure.
Therefore, PL/SQL is a programming language because it contains the
ability to do the following things:
Allows dependencies between commands within the same block of
code.
Allows for parameter passing up and down code block hierarchies. It
allows for structure, namely modular.
Contains a definition of variable scope across code block hierarchies,
strict data typing, and allows use of commonly used programming
control structures.
The downside of PL/SQL is that it should be primarily used as a data-
base access programming language. PL/SQL does not perform well as a
number cruncher like C or Java.
One more point to make is as follows: PL/SQL is becoming increasingly
more capable as an object-like programming language, where the Oracle
relational database allows for hierarchical object data structures. It tries to
anyway. For what it is worth in my experienced opinion, I would avoid
using Oracle Database or PL/SQL to manage objects. If you want to use
object methodologies to manage complexity, put it at the application level
using something like Java or use an object database.