Auto commit
This commit is contained in:
parent
e65236340b
commit
d494b911e0
@ -60,5 +60,23 @@ WHERE money >= 5000 AND money <= 8000;
|
|||||||
|
|
||||||
#6
|
#6
|
||||||
|
|
||||||
|
|
||||||
|
#10 存储过程
|
||||||
|
DELIMITER $$ #改变代码结束符
|
||||||
|
DROP PROCEDURE IF EXISTS pro_GetTopSalary;#创建存储过程之前先删除
|
||||||
|
#设置存储过程名,传入传出参数名和数据类型
|
||||||
|
CREATE PROCEDURE pro_GetTopSalary(IN in_did CHAR(10), OUT out_ename VARCHAR(30))
|
||||||
|
BEGIN
|
||||||
|
#连接查询+排序+分页
|
||||||
|
SELECT e.ename INTO out_ename
|
||||||
|
FROM t_employee e, t_salary s
|
||||||
|
WHERE e.eid = s.eid AND e.did = in_did
|
||||||
|
ORDER BY s.money DESC
|
||||||
|
LIMIT 1;
|
||||||
|
END $$
|
||||||
|
DELIMITER ;
|
||||||
|
#调用存储过程 传入用户变量接收传出数据并使用打印出来
|
||||||
|
CALL pro_GetTopSalary('d0001', @result);
|
||||||
|
SELECT @result;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user