当我在没有存储过程的情况下进行查询时,我对存储过程不熟悉它工作正常,但是当我运行存储过程时它显示错误。
ERROR 1690(22003):BIGINT UNSIGNED值超出范围
DELIMITER ;;
DROP PROCEDURE IF EXISTS sp_price;
Create Procedure sp_price(
IN user_date INT,
OUT exp INT,
BEGIN
select case
when (cast((((start_date) + (31536000 * a))-t2.start_time) as unsigned) )>0
then sum(t2.price)
else 0
end
into exp
from product t1
join customer t2 on t1.p_id=t2.c_id
where t2.created >= user_date;
END
;;
答案 0 :(得分:0)
也许您需要将变量exp声明为unsigned
示例:
....
Create Procedure sp_price(
IN user_date INT,
OUT exp INT unsigned
....
答案 1 :(得分:0)
终于工作了!!!这是解决了一个......
select case
when (((start_date) + (31536000 * a))- (cast(t2.start_time) as signed))>0
then sum(t2.price)
else 0
end
into exp
from product t1
join customer t2 on t1.p_id=t2.c_id
where t2.created >= user_date;