16. Stored Procedures and Parameters

Keywords Introduced


Up until this point, all of our data retrieval has been accomplished with a single SQL statement. Even the set logic seen in the previous chapter involved combining multiple SELECTs into a single statement. Now we’ll discuss a new scenario, in which multiple statements can be saved into a single object known as a stored procedure.

In broad terms, there are two general reasons for using stored procedures:

• To save multiple SQL statements in a single procedure

• To use parameters in conjunction with SQL statements

Stored procedures can, in fact, consist of a single SQL statement and contain no parameters. But ...

Get The Language of SQL, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.