O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

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

Stored procedures

Suppose you need to execute a series of statements in MySQL, instead of sending all SQL statements every time, you can encapsulate all the statements in a single program and call it whenever required. A stored procedure is a set of SQL statements for which no return value is needed.

Apart from SQL statements, you can make use of variables to store results and do programmatical stuff inside a stored procedure. For example, you can write IF, CASE clauses, logical operations, and WHILE loops.

  • Stored functions and procedures are also referred to as stored routines.
  • For creating a stored procedure, you should have the CREATE ROUTINE privilege.
  • Stored functions will have a return value.
  • Stored procedures do not have a return ...

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