28.10 Recording Privileges in the Catalog . . . . . . . . . . . . . . . . . . 675
28.11 Revoking Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
28.12 Security of and Through Views . . . . . . . . . . . . . . . . . . . . . . 680
28.13 Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
CHAPTER 29 Statements for Table Maintenance . . . . . . . . . . . . . . . 683
29.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683
29.2 The ANALYZE TABLE Statement . . . . . . . . . . . . . . . . . . . . . 684
29.3 The CHECKSUM TABLE Statement . . . . . . . . . . . . . . . . . . . 685
29.4 The OPTIMIZE TABLE Statement. . . . . . . . . . . . . . . . . . . . . 686
29.5 The CHECK TABLE Statement . . . . . . . . . . . . . . . . . . . . . . . 687
29.6 The REPAIR TABLE Statement . . . . . . . . . . . . . . . . . . . . . . . 689
29.7 The BACKUP TABLE Statement . . . . . . . . . . . . . . . . . . . . . . 690
29.8 The RESTORE TABLE Statement . . . . . . . . . . . . . . . . . . . . . 691
CHAPTER 30 The SHOW, DESCRIBE, and HELP Statements. . . . . . 693
30.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
30.2 Overview of SHOW Statements . . . . . . . . . . . . . . . . . . . . . . 693
30.3 Additional SHOW Statements . . . . . . . . . . . . . . . . . . . . . . . 698
30.4 The DESCRIBE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 699
30.5 The HELP Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
PART IV Procedural Database Objects. . . . . . . . . . . . . . . 701
CHAPTER 31 Stored Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
31.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
31.2 An Example of a Stored Procedure . . . . . . . . . . . . . . . . . . . . 704
31.3 The Parameters of a Stored Procedure . . . . . . . . . . . . . . . . . 706
31.4 The Body of a Stored Procedure. . . . . . . . . . . . . . . . . . . . . . 707
31.5 Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709
31.6 The SET Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
31.7 Flow-Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
31.8 Calling Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . 719
31.9 Querying Data with SELECT INTO. . . . . . . . . . . . . . . . . . . . 722
31.10 Error Messages, Handlers, and Conditions . . . . . . . . . . . . 726
31.11 Retrieving Data with a Cursor. . . . . . . . . . . . . . . . . . . . . . . 731
31.12 Including SELECT Statements Without Cursors . . . . . . . . . 736
31.13 Stored Procedures and User Variables . . . . . . . . . . . . . . . . 737
31.14 Characteristics of Stored Procedures . . . . . . . . . . . . . . . . . 737
xvi
Contents