Writing mysql stored procedures and functions

Source: Internet
Author: User


Mysql stored procedure and function writing stored PROCEDURE 01 drop procedure if exists temp; 02 delimiter // 03 create procedure temp () 04BEGIN05 declare V_RETUR int; 06 www.2cto.com begin07 if exists (SELECT 1 FROM dual where 1 = 1) then08 IF 1 = 1 then09 set V_RETUR = 1; 10 select V_RETUR; 11 END if; 12 END if; 13 end; 14END // 15 16 17 call temp (); function 1 drop FUNCTION if exists hello; 2 www.2cto.com delimiter // 3 CREATE function hello (s CHAR (20) 4 RETURNS CHAR (50) 5begin6 return concat ('hello, ', s ,'! '); 7end // 8 9 select hello ('admin'); author leaves flowers

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.