mysql 自定义函数(2)操作sql语句
2017-12-31 14:00
465 查看
1、操作select 语句:
其中“select
调用方式:
结果:
drop function if exists hello; create function hello(a int) returns varchar (255) begin declare x varchar(255); select `name` into x from gl_dept where id = a; return x; end;
其中“select
nameinto x from gl_dept where id = a;”里面的“into x“,只是一个给字段添加别名的方式,必须添加,而且别名必须是声明过的。
调用方式:
select hello (5);
结果:
相关文章推荐
- mysql操作命令梳理(5)-执行sql语句查询即mysql状态说明
- MySQL(用户管理,常用sql语句,数据库备份恢复,MySQL调优,恢复误操作数据)
- mysql之sql语句-数据库、表结构相关的基础操作
- Shell脚本中执行sql语句操作mysql的5种方法
- 在myeclipse中配置DB Driver(数据库用MySql),并在myeclipse执行sql语句操作
- mysql之sql语句-数据库、表内容相关的基础操作
- Mysql bench执行sql语句批量操作数据所遇到的问题
- SQL语句处理一些修改、新增、删除、修改属性操作(MySql)
- 关于Python操作Mysql数据库时SQL语句的格式问题(mysql语句中的双引号问题)
- Mysql 将结果保存到文件 从文件中执行sql语句 记录操作过程(tee 命令的使用)
- MYSQL大全(sql语句,基本命令操作)
- 作为开发者必须掌握的mysql操作sql语句优化 - show processlist and explain
- mysql操作数据库总结sql语句总结
- Sql mysql操作语句-初级
- 关于MySql中数据库、表的操作以及增删改查等一些SQL语句注意事项
- myeclipse链接mysql以及简单的sql语句操作,笔记
- Shell脚本中执行sql语句操作mysql
- 【shell sql】shell脚本嵌入mysql语句以进行遍历表的操作
- 使用MySQL for Navicat 创建用户(连接) 及 SQL语句操作
- 五、mysql中sql语句分类及常用操作