Chapter 19. Adding Procedural Capabilities with Persistent Stored Modules

In This Chapter

  • Tooling up compound statements with atomicity, cursors, variables, and conditions

  • Regulating the flow of control statements

  • Doing loops that do loops that do loops

  • Retrieving and using stored procedures and stored functions

  • Assigning privileges, creating stored modules, and putting stored modules to good use

Some of the leading practitioners of database technology have been working on the standards process for years. Even after a standard has been issued and accepted by the worldwide database community, progress toward the next standard doesn't slow down. A seven‐year gap separated the issuance of SQL‐92 and the release of the first component of SQL:1999. During the intervening years, ANSI and ISO issued an addendum to SQL‐92, called SQL‐92/PSM (Persistent Stored Modules). This addendum formed the basis for a part of SQL:1999 with the same name. SQL/PSM defines a number of statements that give SQL flow of control structures comparable to the flow of control structures available in full‐featured programming languages. It enables you to use SQL to perform tasks that programmers were forced to use other tools for. Can you imagine what your life would have been like in the caveman times of 1992, when you'd have to repeatedly swap between SQL and its procedural host language just to do your work?

Compound Statements

Throughout this book, SQL is represented as a nonprocedural language that deals with data ...

Get SQL For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.