mysql 存储过程
来源:互联网 发布:linux vim 删除多行 编辑:程序博客网 时间:2024/06/08 11:28
mysql存储过程: 封装sql: 显示存储过程信息: \G (横向表格采用纵向表格输出)
delimiter $ 改变执行符号,直到mysql碰到$ 开始执行语句命令 set names 解决mysql乱码问题 但mysql重启后又还原到以前字符集状态
call 存储过程名字 () 调用存储过程
参数:
控制结构:
计算1....n的和:
存储过程和函数的区别: 名称不同 :存储过程:procedure 函数function 存储过程没有返回值
1
2
3
4
5
create
procedure
p1()
begin
select
*
from
t_news;
end
$ //mysql存储过程 简单实例
delimiter $ 改变执行符号,直到mysql碰到$ 开始执行语句命令 set names 解决mysql乱码问题 但mysql重启后又还原到以前字符集状态
call 存储过程名字 () 调用存储过程
参数:
1
2
3
4
create
procedure
p2(n
int
) #含参
begin
select
*
from
t_category
where
cid > n;
end
$
控制结构:
1
2
3
4
5
6
7
8
create
procedure
p3(n
int
, j
char
(1)) #含参
begin
if j=
'h'
then
#与其他语言不同 必须加
then
注意符号= 不是==
select
*
from
t_category
where
cid > n;
else
select
*
from
t_category
where
cid <n;
end
if;
end
$
计算1....n的和:
1
2
3
4
5
6
7
8
9
10
11
12
create
procedure
p4(n
smallint
) #含参
begin
declare
i
int
;
declare
s
int
;
set
s = 0;
set
i = 1;
while i<=n do
set
s =s+i;
set
i=i+1;
end
while;
select
s;
end
$
存储过程和函数的区别: 名称不同 :存储过程:procedure 函数function 存储过程没有返回值
0 0
- 【mysql】mysql存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- 专业词汇之对象池、连接池、线程池
- 开发工具IDEA
- Cannot reload AVD list: cvc-enumeration-valid: Value '280dpi' is ....问题解决
- Linux操作系统启动过程详解
- NYOJ 115城市平乱 【dijkstra】
- mysql 存储过程
- 所谓未来,就是现在
- Resource(4)
- wifi知识介绍
- 用户进程内存空间
- Andriod之EditText监听,实时的判断输入多少字符
- JDK 下载和安装
- App Store审核指南中文版
- Fragment笔记1