안녕하세요...
MYSQL 프로시져에서 페이징을 구현하려고 합니다..
샘플을 만들어 보는데...자꾸 등록에서 에러가 발생합니다..
어떤 이유에서인지좀 알수 있을런지요..??
DELIMITER $$
CREATE PROCEDURE SP_CONTENTLOGLOADALL(
IN StartTime VARCHAR(30),
IN EndTime VARCHAR(30),
IN UploadFormat VARCHAR(20),
IN StateValue INT,
IN OriginalFileName VARCHAR(400),
IN PageIndex INT,
IN PageSize INT,
OUT TotalRecords INT
) READS SQL DATA
BEGIN
DECLARE L_UploadFormat VARCHAR(10);
DECLARE L_OriginalFileName VARCHAR(200);
DECLARE L_RecordCount INT DEFAULT '0';
DECLARE L_PageLowerBound INT;
DECLARE L_PageUpperBound INT;
DECLARE L_RowsToReturn INT;
DECLARE L_StartTime VARCHAR(30) DEFAULT NULL;
DECLARE L_EndTime VARCHAR(30) DEFAULT NULL;
DECLARE L_StateValue INT DEFAULT '0';
DECLARE L_PageIndex INT DEFAULT '0';
DECLARE L_PageSize INT DEFAULT 2147483644;
SET L_PageLowerBound = L_PageSize * L_PageIndex;
SET L_PageUpperBound = L_PageLowerBound + L_PageSize + 1;
SET L_UploadFormat = LTRIM(RTRIM(IFNULL(UploadFormat , '')));
SET L_OriginalFileName = LTRIM(RTRIM(IFNULL(OriginalFileName , '')));
SET L_UploadFormat = CONCAT( '%' , CAST(L_UploadFormat AS CHAR ) , '%' );
SET L_OriginalFileName = CONCAT( '%' , CAST(L_OriginalFileName AS CHAR ) , '%' );
-- 해당구문에서 에러발생
SELECT * FROM t_bannedipaddress Order by t_bannedipaddressid desc limit L_PageLowerBound , L_PageSize;
END
$$
DELIMITER ; |