过程
CREATE DEFINER=`root`@`%` PROCEDURE `clearDate_Jk`()
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
DELETE FROM sys_dept WHERE create_time > '2023-12-31';
truncate table sys_file;
END
CREATE DEFINER=`root`@`%` PROCEDURE `getAssets`(
IN `companyId` BIGINT
)
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
SELECT CAST(JSON_UNQUOTE(JSON_EXTRACT(a.infos,'$."总资产"')) AS DECIMAL(10, 2)) AS zzc
FROM bs_company_financial a WHERE del_flag =0 AND years = YEAR(CURDATE())
ORDER BY update_time LIMIT 1;
END
函数
CREATE DEFINER=`root`@`%` FUNCTION `tt`(
`Param1` INT
)
RETURNS decimal(10,0)
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
declare num decimal default 0;
set num = Param1;
return num;
END
标签:COMMENT,存储,函数,LANGUAGE,CREATE,mySql,BEGIN,SQL,DEFINER
From: https://www.cnblogs.com/linhan8888/p/18210011