程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> int-求大神 幫我看下這個存儲過程哪裡錯了

int-求大神 幫我看下這個存儲過程哪裡錯了

編輯:編程綜合問答
求大神 幫我看下這個存儲過程哪裡錯了

DROP PROCEDURE IF EXISTS Query_Role_PhoneRecord;
DELIMITER ;;
CREATE DEFINER=root@% PROCEDURE Query_Role_PhoneRecord(

in userId binary(16),
in pagNo int,
in pagSize int

)
BEGIN
declare bSize int;

set bSize=(pagNo-1)*pagSize;
if(bSize<0) then
set bSize =0; end if;
SELECT
view_role_phonerecord.ID,
view_role_phonerecord.LimId,
view_role_phonerecord.Recordor,
view_role_phonerecord.RecordTime,
view_role_phonerecord.BDID,
view_role_phonerecord.Caller,
view_role_phonerecord.PhonNo,
view_role_phonerecord.CallType,
view_role_phonerecord.Record,
view_role_phonerecord.IsRecordorActive
FROM cemscenter.view_role_phonerecord
where view_role_phonerecord.UserId=userId
limit bSize,pagSize;

END
;;
DELIMITER ;

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bSize,pagSize;

END' at line 26

最佳回答:


limit需要連接或者預編譯

 PREPARE stmt1 FROM 'select * from users LIMIT ?,?'; 
SET @a = ino; 
SET @b = pagecount 
EXECUTE stmt1 USING @a, @b;
deallocate prepare stmt1; 

or 
set dd=conact('select * from users LIMIT',ino,pagecount) 
PREPARE stmt1 FROM dd 
EXECUTE stmt1
deallocate prepare stmt1;
qq_23565535
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved