Second, stored procedures usually improve performance. Without stored procedures, SQL commands
must be presented to the DBMS, and the DBMS must check them for errors, compile the statements, develop
execution plans, and then execute the plans and return the results. On the other hand, if the procedure
is precompiled and stored, less error checking is necessary, and the execution plan is already in place.
For database applications that are concerned with performance, using stored procedures is a standard strategy
for success.
Third, using stored procedures is a way to achieve reuse of code. To the extent that different users and
programs can take advantage of the same stored procedures, programming time can be saved, and consistency
among applications can be assured.
Fourth, stored procedures are secured with the same mechanisms that secure the data itself. Sometimes the
procedures encapsulate important business rules or proprietary data processing, so keeping them secure is
important. Stored procedures are stored in the database itself, and access to them is secured just as access to the
data is. This can be an advantage compared to separately securing source code.
The only disadvantage of using stored procedures is that using them introduces a requirement for another
programming expertise.
Pages:
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433