Stored procedures are
programs that are precompiled and stored in the database itself. Users can access the stored procedures to
inquire of, and make changes to, the database, and they can do this interactively using commands, or by using
programs that call stored procedures and receive the results.
Stored procedures are written in a language that extends standard SQL to include more programming
constructs, like conditional branching, looping, I/O, and error handling. Each vendor??™s language is different
in details, so one must learn the language of the particular database management system to which one is
committed.
There are several advantages of stored procedures as a way to access a database. First, a procedure may be
complex in its work, and yet be easy for a casual user to invoke. The skilled database programmer can create
stored procedures that will make day-to-day use of the database more convenient. For instance, the user may
simply want to record a sale to a customer, and the user may not be aware that the database will require updates
to both the Customer and Product tables. A stored procedure can accept the facts (customer name, price, quantity,
product, etc.) and then accomplish all the updates behind the scenes.
Pages:
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432