I have created a sp little bit confuse about it. how to count result set if data availabe then show it and if not then retun ResultStatus is zero. did not work much with sp. thanks for any help suggestions.
CREATE DEFINER=`root`@`localhost` PROCEDURE `usp_GetProduct`(IN `iProductCategoryId` INT)
BEGIN
DECLARE ResultStatus INT default 0;
DECLARE exit handler for sqlexception
BEGIN
-- ERROR
#set ErrorCode = -999;
rollback;
END;
DECLARE exit handler for sqlwarning
BEGIN
-- WARNING
#set ErrorCode = -888;
rollback;
END;
START TRANSACTION;
SELECT P.iProductId AS ProductId,P.vProductName AS ProductName,P.vProductCode AS ProductCode,P.iCategoryId AS CategoryId,P.tDescription AS Description,P.vProductWebsiteURL AS ProductWebsiteURL,P.iProductCategoryId AS CategoryId,P.eShowOnHomePage AS ShowOnHomePage,P.vProductImage1 AS ProductImage1,P.vProductImage2 AS ProductImage2,P.dPrice AS Price,P.eStatus AS Status,P.iCreatedById AS CreatedById,P.dCreatedDate AS CreatedDate,P.iModifiedById AS ModifiedById,P.dModifiedDate AS ModifiedDate, PC.vProductCategoryName AS ProductCategoryName FROM skin_product P
INNER JOIN skin_productcategory PC ON PC.iProductCategoryId = P.iProductCategoryId
WHERE P.iProductCategoryId = IFNULL(iProductCategoryId, P.iProductCategoryId);
#set ErrorCode = 0;
SET ResultStatus=1;
SELECT @ResultStatus as Status;
COMMIT;
SELECT @ResultStatus as Status;
END