When we include a SQL statement that does not return a result set—such as an UPDATE, INSERT, or SET statement—within a stored program, it will execute exactly as it would if it were executed in some other context (such as if it were called from PHP or issued from the MySQL command line).
SQL statements within stored programs follow the same syntax as they would outside of the stored program. The SQL statements have full access to any stored program variables, which can be used wherever a literal or expression would normally be provided to the SQL.
You can use all the major categories of SQL statements inside stored programs. DML, DDL, and utility statements can be used without restriction.
Example 5-1 uses a combination of DDL and DML to create and manipulate the data in a table.