DELIMITER //
create procedure chk_tot(in c_num int)
begin
declare
tot_ord double;declare
msg_text varchar(45);select sum(amount) into tot_ord from orders
where cust = c_num;
if tot_ord < 30000
msg_text= 'high order total';else
msg_text='low order total';
end;
//
-----------------------------------------------------------------
说错误在msg_text= 'high order total';else
msg_text='low order total';附近 T.T 绞尽脑汁了啊
create procedure chk_tot(in c_num int)
begin
declare
tot_ord double;declare
msg_text varchar(45);select sum(amount) into tot_ord from orders
where cust = c_num;
if tot_ord < 30000
msg_text= 'high order total';else
msg_text='low order total';
end;
//
-----------------------------------------------------------------
说错误在msg_text= 'high order total';else
msg_text='low order total';附近 T.T 绞尽脑汁了啊
set msg_text='low order total';
这个改过来了 还有错 在第20行 = = 20行就各end;哪错了啊!!!
DROP PROCEDURE IF EXISTS chk_tot//
CREATE PROCEDURE chk_tot(IN c_num INT)
BEGIN
DECLARE tot_ord DOUBLE;
DECLARE msg_text VARCHAR(45);
SELECT SUM(amount) INTO tot_ord FROM orders WHERE cust = c_num;
IF tot_ord < 30000 THEN
SET msg_text= 'high order total';
ELSE
SET msg_text='low order total';
END IF;
END;//
DELIMITER ;