- 论坛徽章:
- 0
|
我在mysql中创建一个存储过程
表中有一个 (日期 datetime) 字段,要取某个时间段的第a到b条,如'2012-04-20‘到'2012-04-25'时间段的第50到100条.
以下是建立存储过程语句
create procedure pro_select_sitedata
(in P_start_time datetime,
in P_end_time datetime,
in a integer,
in b integer)
BEGIN
select * from result
where 日期 between P_start_time and P_end_time
limit a,b;
END
它提示错误:ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'a,b;
可是我如果把a,b换成常量
create procedure pro_select_sitedata
(in P_start_time datetime,
in P_end_time datetime,
in a integer,
in b integer)
BEGIN
select * from result
where 日期 between P_start_time and P_end_time
limit 50,50;END
就没问题了,请教一下为什么?谢谢 |
|