O'Reilly logo

The Language of SQL, Second Edition by Larry Rockoff

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

16. Stored Procedures and Parameters

Keywords Introduced

CREATE PROCEDURE  •  BEGIN  •  EXEC/CALL  •  ALTER PROCEDURE  •  DROP PROCEDURE

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 ...

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