O'Reilly logo

Joe Celko's SQL for Smarties, 4th Edition by Joe Celko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7

Procedural Constructs

Although SQL is a declarative language, it does have procedural features: stored procedures, triggers, and cursors. Stored procedures, or more properly, Persistent Stored Modules (SQL/PSM), give SQL its own 4GL programming language. Triggers are stored procedures attached to one table and controlled by database events such as inserts, updates, and deletes on it. Cursors convert a query, update, or delete statement into a sequential file structure that can be accessed one row at a time.

We will now discuss each one in more detail, but you will find that stored procedures are by far the most useful of the three. Triggers exist because the early SQL Standards did not have declarative referential integrity (DRI) actions. Later ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required