create procedure myproc(
in deptnox int,
out low decimal(8,2),
out height decimal(8,2),
out myavg decimal(8,2))
BEGIN
select min(sal) into low from emp where emp.deptno=deptnox;
select max(sal) into height from emp where emp.deptno=deptnox;
select avg(sal) into myavg from emp where emp.deptno=deptnox;
END;
这个语句有什么语法错误吗,为什么我一直在mysql query brower 中不能执行呢,提示 myavg 未定义。。
in deptnox int,
out low decimal(8,2),
out height decimal(8,2),
out myavg decimal(8,2))
BEGIN
select min(sal) into low from emp where emp.deptno=deptnox;
select max(sal) into height from emp where emp.deptno=deptnox;
select avg(sal) into myavg from emp where emp.deptno=deptnox;
END;
这个语句有什么语法错误吗,为什么我一直在mysql query brower 中不能执行呢,提示 myavg 未定义。。
在mysql command 下 执行之前是加了 "delimiter // "的,
现在再mysql browser 中加上 "delimiter // " 同样通过
当你提交语句分析到
create procedure myproc(
in deptnox int,
out low decimal(8,2),
out height decimal(8,2),
out myavg decimal(8,2))
BEGIN
select min(sal) into low from emp where emp.deptno=deptnox;的时候就提交运行了,当然要出错。