最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

php 执行存储过程返回值得有关问题?

来源:http://erdangjiade.com/topic/79829.html 你好,世界。 2017-10-04 21:03浏览(0)

php 执行存储过程返回值得问题???
我的mysql存储过程代码如下
怎么样在php中执行时得到对应的返回值???
declare vCNC_ID int;
set vCnt=0;
SELECT count(trlm.TRAVELER_ID) into vCnt from tr_traveler_lot_master trlm
WHERE trlm.ORGANIZATION_ID=pOrg_ID AND trlm.SITE_ID=pSite_id
AND trlm.TRAVELER_CODE=pTraveler_code;
IF ISNULL(vCnt)=0 and vCnt>0 THEN
SELECT trlm.TRAVELER_ID into vTraveler_id from tr_traveler_lot_master trlm
WHERE trlm.ORGANIZATION_ID=pOrg_ID AND trlm.SITE_ID=pSite_id
AND trlm.TRAVELER_CODE=pTraveler_code;
ELSE
SELECT '错误的托盘ID.....!';
-- SELECT 'No Traveler ID issued.....!';
LEAVE proc_main;
END IF;
set vCnt=0;
SELECT count(trll.TRAVELER_ID) into vCnt from tr_traveler_lot_logging trll
WHERE trll.ORGANIZATION_ID=pOrg_ID AND trll.SITE_ID=pSite_id
AND trll.TRAVELER_ID=vTraveler_id and TRANSACTION_CODE<9;
IF ISNULL(vCnt)=0 and vCnt>0 THEN
SELECT '托盘ID已经开始.....!';
-- SELECT 'Traveler ID had been started.....!';
LEAVE proc_main;
ELSE
SELECT CNC_ID into vCNC_ID FROM tr_cnc_master tcm where tcm.ORGANIZATION_ID=pOrg_id and tcm.CNC_CODE= pCNC_CODE;
END IF; -- Second Count
-- Check CNC is in running by other Tray
set vCnt=0;
SELECT count(trll.TRAVELER_ID) into vCnt from tr_traveler_lot_logging trll
WHERE trll.ORGANIZATION_ID=pOrg_ID AND trll.SITE_ID=pSite_id
AND trll.CNC_ID=vCNC_ID and TRANSACTION_CODE<9;
IF ISNULL(vCnt)=0 and vCnt>0 THEN
SELECT 'ABCID已经开始被其他托盘使用.....!';
-- SELECT 'CNC ID had been started by other tray.....!';
LEAVE proc_main;
END IF; -- Check CNC is in running by other Tray
-- Check CNC load Program or not
set vCnt=0;
SELECT count(tch.CNC_ID) into vCnt from tr_cnc_header tch
WHERE tch.ORGANIZATION_ID=pOrg_ID AND tch.CNC_ID=vCNC_ID;
IF ISNULL(vCnt)=0 and vCnt>0 THEN
SELECT CNC_ID into vCNC_ID FROM tr_cnc_master tcm where tcm.ORGANIZATION_ID=pOrg_id and tcm.CNC_CODE= pCNC_CODE;
call Traveler_LogCreation (pOrg_id,vTraveler_id,pSite_ID,1,sysdate(),vCNC_id,pUser);
ELSE
SELECT '无 ABC 程序配置.....!';
-- SELECT 'No CNC program loaded.....!';
LEAVE proc_main;
END IF; -- Third Count
SELECT 'Ok';
end proc_main

------解决方案--------------------
你这个存储过程会返回多个结果集吧?看不大清楚
如果是,那么请用 mysqli 扩展或 PDO 类,mysql 扩展只能接受一个结果集
读取时需分别用
mysqli_next_result
PDOStatement::nextRowset
移动结果集指针
注意:只要结果集没有读空。就不能重新查询

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2