我有这个存储过程,它没有返回任何记录,而其中的SELECT语句工作得很好。像这样运行SP:
CALL get_due_amount('654321');
什么都不返回。没有显示错误。 这个存储过程有什么问题? TXS。
DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `get_due_amount`(
IN `_booking_ref_no` VARCHAR(50))
NO SQL
SELECT
ph.booking_id,
Cast(SUM(ph.amount) AS DECIMAL(8,2)) as paid,
b.booking_total,
b.booking_ref_no,
(b.booking_total - SUM(ph.amount)) as due
FROM `i_payments_history` ph JOIN
pt_bookings b on b.booking_id = ph.booking_id
WHERE b.booking_ref_no LIKE '_booking_ref_no'
GROUP BY b.booking_id;