Home > Backend Development > PHP Tutorial > mysql MySqlDump database backup code (1/2)_PHP tutorial

mysql MySqlDump database backup code (1/2)_PHP tutorial

WBOY
Release: 2016-07-13 17:04:23
Original
856 people have browsed it

mysql tutorial MySqlDump database tutorial backup code

DELIMITER $$

CREATE DEFINER=`root`@`localhost` FUNCTION `UF_Get_tMaxCode`(
V_iType INT
) RETURNS varchar(10) CHARSET utf8
BEGIN
/*
Business description: Generate codes based on coding categories

Input parameters:
V_iType: encoding category, defines the definition of the iType field of tMaxCode

Call example:
SELECT UF_Get_tMaxCode(1);

Creation date:
Created by:

*/
DECLARE iCode INT;

IF V_iType IN (1,3)

THEN
#Non-order type
IF EXISTS (SELECT dtLast FROM tMaxCode WHERE iType=V_iType LIMIT 0,1)
THEN
SELECT IFNULL(iMax,0)+1 INTO iCode FROM tMaxCode WHERE iType=V_iType;
ELSE
SET iCode=1;
END IF;
SELECT IFNULL(iMax,0)+1 INTO iCode FROM tMaxCode WHERE iType=V_iType;
ELSE
#Order type
IF EXISTS (SELECT iMax FROM tMaxCode WHERE iType=V_iType AND DATEDIFF(dtLast,CURRENT_DATE)=0 LIMIT 0,1)
THEN
#The last generation time was today
SELECT IFNULL(iMax,0)+1 INTO iCode FROM tMaxCode WHERE iType=V_iType;
ELSE
SET iCode=1;
END IF;
END IF; 1 2

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630864.htmlTechArticlemysql tutorial MySqlDump database tutorial backup code DELIMITER $$ CREATE DEFINER=`root`@`localhost` FUNCTION `UF_Get_tMaxCode` ( V_iType INT ) RETURNS varchar(10) CHARSET utf8 BEGIN /* Industry...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template