0
我有以下存儲過程設置,它在過去幾天剛剛停止工作。有誰知道爲什麼這可能會停止工作?沒有任何數據庫表已經改變。MySQL存儲過程剛剛停止工作
drop procedure if exists bookings_by_voucher;
delimiter //
create procedure bookings_by_voucher(in start_date date, in end_date date, l_id int)
language sql
deterministic
sql security definer
begin
declare s text;
select distinct group_concat(concat('sum(if(c.gross_value = ',gross_value,',c.net_value,0)) coupon',
cast(gross_value as unsigned))) from coupons into s;
set @query = concat('select ',if(l_id is null, '"All Locations"','l.location_name'),
' location_name,ifnull(b.places, 0) as places, ',
if(start_date is null and end_date is null,'"All Dates"',
if(start_date is null, concat('" <= ',end_date,'"'),
if(end_date is null,concat('" >= ',start_date,'"'),
concat('"',start_date,' - ',end_date,'"')
)
)
),' dates,',
ifnull(s,'"No Coupons"'),
',round(sum(b.price/1.2-ifnull(c.net_value,0)), 2) paidbycard from locations l join bookings b ',
' on l.id = b.location_id ',
concat(if(start_date is null,'',concat(' and b.date >= "', start_date,'"'))),
concat(if(end_date is null,'',concat(' and b.date <= "', end_date,'"'))),
' left join coupons c on b.voucher_code = c.code',
if (l_id is null, ' group by l.id', concat(' where l.id = ', l_id)));
/*select @query;*/
prepare stmt from @query;
execute stmt;
end//
,我從我的應用程序取回(建於Laravel 5.1)的錯誤是:
SQLSTATE [42000]:語法錯誤或訪問衝突:1064您有一個 錯誤的SQL語法;請檢查與您的 MySQL服務器版本相對應的手冊,以獲取正確的語法,以便在位置附近使用' paidbycard l在l.id = b.location_id處加入預訂b在第1行加入 '(SQL:call bookings_by_voucher(null, null,null))
你得到什麼錯誤? – Matt
您將不得不提供有關「停止工作」的更多信息。 – spender
@Matt我已更新我的問題與錯誤。 – V4n1ll4