MySQL创建存储过程
来源:互联网 发布:哪下载软件安全 编辑:程序博客网 时间:2024/05/16 14:41
MySQL创建存储过程
drop procedure test_add if exists;-- 创建存储过程(不可以使用create or replace)create procedure test_add( a INT, b INT)BEGIN declare c int; if a is null then set a = 0; end if; if b is null then set b = 0; end if; set c = a + b; select c as sum;end;--运行set @a=10;set @b=10;call test_add(@a,@b);
以上是在navicat中可以,但是在workbench或mysql command client中不行。这是因为navicat会自动设置不同的分隔符,做了处理。在workbench和mysql command client中要使用以下的格式:
-- 设置Delimiter,防止和存储过程中的冲突Delimiter //;create procedure test_add( a int, b int)BEGIN declare c int; if a is null then set a = 0; end if; if b is null then set b = 0; end if; set c = a + b; select c as sum;end; //-- 恢复默认的Delimiter;Delimiter ; //
0 0
- mysql创建存储过程
- mysql创建存储过程
- mysql创建存储过程
- mysql创建存储过程
- mysql创建存储过程
- mysql存储过程创建
- mysql创建存储过程
- mysql创建存储过程
- MySQL存储过程 创建
- mysql创建存储过程
- mysql创建存储过程
- MySQL创建存储过程
- MySQL创建存储过程
- mysql创建存储过程
- mysql创建存储过程
- mysql 创建存储过程
- mysql创建存储过程
- mysql创建存储过程
- 数学与编程(二)
- linux tail命令
- OpenCV2.4.10之samples_cpp_tutorial-code_learn-----ImgTrans(Hough变换)
- JS逗号运算符的用法详解
- 主成分分析(PCA)
- MySQL创建存储过程
- Android实现跑马灯效果总结
- MySql查询方式优化-重新构建查询
- RootHub感应设备的插拔
- 嵌入式dvfs动态调频调压技术
- 关于结对编程
- java---转换流1(InputStreamReader和OutputStreamWriter)
- 欢迎使用CSDN-markdown编辑器
- hdoj 5672 String (尺取法)