存储过程中的游标

时间:2015-02-05 21:22:26

标签: mysql sql stored-procedures cursor

我正在使用存储过程中的游标进行战斗。我正在使用MySQL版本5.1

这是我目前的尝试:

declare calc cursor for 
select 
  b.cant as cantidades, 
  workdaydiff(str_to_date(a.fecha_emision,'%d/%m/%Y'), b.fecha) as dias
from accion_correctiva_preventiva a, 
     reporte_no_conformidad b 
 where a.numero_nc = b.numero 
 and month(b.fecha) = mes 
 and year(b.fecha) = anho 
 and b.tipo_nc like 'producto';

查询会抛出一个说error #1064 you have an error in your sql syntax的异常。任何人都可以看到语法错误吗?

0 个答案:

没有答案