0
在這段代碼中,它總是輸出NULL(儘管他們有數據,但沒有任何數據)。我試圖從2表(customer和order_status)獲取id_cust,lastName,addRess。誰能幫我?即時通訊新的SQL。爲什麼我總是在mySQL中輸出爲空?
delimiter //
#drop procedure if exists GetOrderStatus
create procedure GetOrderStatus(IN id_cust INT,
OUT lastName VARCHAR(45),
OUT o_number INT,
OUT addRess VARCHAR(45))
begin
declare id_cust INT;
declare lastName VARCHAR(45);
declare addRess VARCHAR(45);
declare ci_ty VARCHAR(45);
declare dscrption VARCHAR(45);
declare o_number INT;
declare order_stts VARCHAR(45);
declare total_item INT;
declare reMarks VARCHAR(45);
declare curs cursor for
select c.c_id,o.order_no,o.o_status,o.item_total,c.description,o.remarks,c.lname
from order_status o, customer c;
open curs;
fetch curs into id_cust,o_number,order_stts,total_item,dscrption,reMarks,lastName;
select id_cust,lastName,addRess from customer
where id_cust > 2
and customer.id_cust = order_status.id_cust;
end
你爲什麼putthe字「輸出」在@address VARCHAR(45 )輸出?請給我解釋.. – 2014-09-11 04:53:02
爲什麼sql說我在線1上有錯誤代碼1064,它是「創建過程GetOrderStatus(@id_cust INT,...」 – 2014-09-11 06:18:23
對不起,我以爲你使用的是T_SQL,但是你正在使用MySQL。我已經適當地修改了SQL。 – 2014-09-11 13:45:44