当前位置:网站首页>MySQL storage and custom functions
MySQL storage and custom functions
2022-06-26 07:05:00 【Rorschach379】
select col_name,
case when char_length(col_intro)>20 then
concat(left(col_intro,20),'.....')
else col_intro end
from tb_college;
drop function if exists truncate_string;
delimiter $
create function truncate_string(
content varchar(12000),
max_length int unsigned
)
returns varchar(12000) no sql
begin
declare result varchar(12000)default content;
if char_length(content)>max_length then
set result=concat(left(content,max_length),'.....');
end if;
return result;
end $
delimiter ;
select col_name,
truncate_string(col_intro,20)
from tb_college;
delimiter $
create procedure sp_upgrade_emp_sal()
begin
start transaction;
update tb_emp set sal=sal+100 where dno=10;
update tb_emp set sal=sal+200 where dno=20;
update tb_emp set sal=sal+300 where dno=30;
commit;
end$
delimiter ;
call sp_upgrade_emp_sal();
delimiter $
create procedure sp_get_avg_sal(
in dept_no int,
out avg_sal decimal(10,2)
)begin
select round(avg(sal),2) into avg_sal
from tb_emp where dno=dept_no;
end $
delimiter ;
call sp_get_avg_sal(10,@sal);
select @sal;
边栏推荐
- How to publish function computing (FC) through cloud effect
- shell 输入验证仅限字母数字
- Redis系列——redis启动,客户端day1-2
- MySQL (III)
- 面试被问Redis主从复制不会答?这13张图让你彻底弄明白
- oracle创建带返回值的存储过程并sql执行调用
- 异地北京办理居住证详细材料
- China's Ni MH battery industry development overview analysis and investment trend forecast report 2022 Edition
- 【图像融合】基于梯度能量、局部能量、 PCA三种融合规则实现MRI-CT图像融合附matlab代码
- $a && $b = $c what???
猜你喜欢

Massive log collection tool flume

Dark red crystal meso-5,10,15,20-tetra (p-aminophenyl) cobalt porphyrin (co TAPP); Meso-5,10,15,20-tetra (p-aminophenyl) cobalt porphyrin no complex (TAPP co no) supplied by Qiyue

I have been testing at Tencent for several years
![[path planning] robot path planning based on improved artificial potential field with matlab code](/img/82/b4cfb84de1cd56abe0c51205e99035.png)
[path planning] robot path planning based on improved artificial potential field with matlab code

ZRaQnHYDAe

MySQL basic usage 01

Excel中Unicode如何转换为汉字

Numpy learning challenge level 4 - numpy array attribute

LabVIEW Arduino tcp/ip remote smart home system (project part-5)

Cocoscreator plays spine animation
随机推荐
解决dialog 底部透明的问题
C#实现给DevExpress中GridView表格指定列添加进度条显示效果——代码实现方式
item2安装配置及环境失效问题解决
MySQL 'replace into' 的坑 自增id,备机会有问题
Stm32f1 and stm32subeide programming example - thermal sensor driver
. Net 20th anniversary! Microsoft sends a document to celebrate
My SQL (II)
Mysql操作数据库
php array_merge详解
Iron / zinc / copper / platinum metal complexes such as 5,10,15,20-tetra (4-hydroxyphenyl) porphyrin (THPP) / (thppfe) / (thppzn) / (thppcu) / (thpppt) - Qiyue R & D
ZRaQnHYDAe
Fmt Must the result of println (true) be true?
SQL query statement
3,3 '- di (3,4-dicarboxyphenoxy) -4,4' - diphenylethynylbiphenyldianhydride (bpebpda) / porphyrin 2dcofs (H2P COF, ZNP COF and cup COF) supplied by Qiyue
What is data mining?
数据湖架构之Hudi编译篇
Here comes the apple ar/vr device exclusive system! Or named realityos
【路径规划】基于改进人工势场实现机器人路径规划附matlab代码
高德地图使用自定义地图无效问题
shell 输入验证仅限字母数字