MySQL Stored procedure example

Source: Internet
Author: User
DELIMITER $ $USE ' weipansettlementdb ' $ $DROP PROCEDURE IF EXISTS ' Proc_demo ' $ $CREATE definer= ' weipan_jy ' @ ' localhost ' PROCEDURE ' Proc_demo ' (  p_demo varchar (8), #参数 out  op_code INT, #小于0为错误代码, greater than 0 for the delegate number out  op_msg VARCHAR (30) # return information)    modifies SQL dataproc_demo:begin  DECLARE v_demo VARCHAR (8);    DECLARE EXIT HANDLER for SQLEXCEPTION  BEGIN    SHOW WARNINGS;    ROLLBACK;    SET Op_code=-1;    SET op_msg= ' flot_getmsg ' ( -1);  END;  SET Op_code=-1;  SELECT ' demo ' into V_demo from ' T_demo ' WHERE ' demo ' = P_demo;  IF V_demo = P_demo then   LEAVE Proc_demo; END IF;  START TRANSACTION;  COMMIT;  SET op_code = 0; SET op_msg= ' flot_getmsg ' (0);  end$ $DELIMITER;

  

MySQL Stored procedure example

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.