11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 32 • STORED ROUTINESwww.it-ebooks.infoDatabase Collation: latin1_swedish_ci*************************** 2. row ***************************Db: corporateName: get_productsType: PROCEDUREDefiner: root@localhostModified: 2010-03-12 19:07:34Created: 2010-03-12 19:07:34Security_type: DEFINERComment:character_set_client: latin1collation_connection: latin1_swedish_ciDatabase Collation: latin1_swedish_ci2 rows in set (0.02 sec)Viewing a Routine’s Creation SyntaxIt’s possible to review the syntax used to create a particular routine by using the SHOW CREATE statement.Its prototype follows:SHOW CREATE (PROCEDURE | FUNCTION) dbname.spnameFor example, the following statement will re-create the syntax used to create the get_products()procedure:SHOW CREATE PROCEDURE corporate.maintenance\GExecuting this command produces the following output (slightly formatted for readability):*************************** 1. row ***************************Procedure: maintenancesql_mode: STRICT_TRANS_TABLES,NO_AUTO_CREATE_USERCreate Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `maintenance`()BEGINCALL process_logs();CALL process_users();ENDcharacter_set_client: latin1collation_connection: latin1_swedish_ciDatabase Collation: latin1_swedish_ciHandling ConditionsEarlier, this chapter mentioned that the DECLARE statement can also specify handlers that can executeshould a particular situation, or condition, occur. For instance, a handler was used in the calc_bonus644

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!