当前位置:网站首页>[MySQL learning notes 28] storage function
[MySQL learning notes 28] storage function
2022-07-01 07:34:00 【yqs_ two hundred and eighty-one million eight hundred and seven】
Stored functions are very similar to stored procedures , See :【mysql Learning notes 27】 stored procedure
The storage function has a return value , And the parameter can only be in type
grammar :
CREATE FUNCTION Function name ([ parameter list ])
RETURNS type [characteristic...]
BEGIN
--- SQL sentence
RETURN ...;
END;
characteristic( characteristic ):
- DETERMINISTIC: The same input parameters always produce the same results
- NO SQL: It doesn't contain SQL sentence
- READS SQL DATA: Contains query statements but no write statements
Example
--- Return from 1 To n The cumulative value of
create function sum(n int)
returns int deterministic
begin
declare total int default 0;
while n>0 do
set total:=total+n;
set n:=n-1;
end while;
return total;
end;
边栏推荐
- [Shenzhen IO] precise Food Scale (some understanding of assembly language)
- redisson使用全解——redisson官方文档+注释(上篇)
- JSP - paging
- Jax's deep learning and scientific computing
- 关于“2022年度网络安全教育线上培训”相关问题的复盘和说明
- Stepsister becomes stepmother, son breaks off relationship with himself, and musk, the world's richest man, why is it so miserable?
- Understanding of Turing test and Chinese Room
- 【微服务|openfeign】Feign的日志记录
- TodoList经典案例①
- 2022 mobile crane driver test exercises and online simulation test
猜你喜欢

【推荐系统】美团外卖推荐场景的深度位置交互网络DPIN的突破与畅想

组件的自定义事件②

kubernetes资源对象介绍及常用命令(二)

Image style migration cyclegan principle

MATLAB之基础知识

Minecraft 1.16.5 module development (51) tile entity

LeetCode+ 71 - 75

Huawei modelarts training alexnet model

Discussion on several research hotspots of cvpr2022

赌上了绩效,赢了公司CTO,我要搭DevOps平台!
随机推荐
Ctfhub port scan (SSRF)
【无标题】
weback5基础配置详解
十大劵商如何开户?另外,手机开户安全么?
AUTOSAR learning record (1) – ECUM_ Init
【mysql学习笔记28】存储函数
[R language] two /n data merge functions
We found a huge hole in MySQL: do not judge the number of rows affected by update!!!
Are there any practical skills for operation and maintenance management
Custom events of components ②
【mysql学习笔记27】存储过程
【深圳IO】精确食品称(汇编语言的一些理解)
The database is locked. Is there a solution
良心安利万向轮 SolidWorks模型素材网站
2022电工(中级)复训题库及答案
vscode 根据 ESLint 规范自动格式化代码
北漂程序员深夜emo发帖求助:女朋友走了我很孤独 ......
Alibaba OSS postman invalid according to policy: policy condition failed: ["starts with", "key", "test/"]
redisson使用全解——redisson官方文档+注释(下篇)
[chapter 72 of the flutter problem series] a solution to the problem that pictures taken in the flutter using the camera plug-in are stretched