By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,780 Members | 1,550 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,780 IT Pros & Developers. It's quick & easy.

Error Code : 1329, No data - zero rows fetched, selected, or processed. MYSQL

P: 3
Error Code : 1329, No data - zero rows fetched, selected, or processed. MYSQL
I am getting the following error while running a stored procedure in mysql5.0

Error Code : 1329
No data - zero rows fetched, selected, or processed.

I have an stored procedure SP1 which calls stored procedure SP2 and SP2 calls a function F1.

I have run this script from .bat file.

after executing i tried to call stored procedure 1 (update_stock), it gives error listed top.

But if i open stored procedure from sqlyog by clicking on alter procedure and rerun the stored procedure.

next time when i call the procedure it executes properly with out error.

Please help me with some solution.

The basic structre of procedure and function is given below


For eg.


----- stored procedure 1 -------------

Expand|Select|Wrap|Line Numbers
  1. DELIMITER $$;
  2.  
  3. DROP PROCEDURE IF EXISTS `update_stock`$$
  4. CREATE PROCEDURE `update_stock`(upload_date varchar(10))
  5. BEGIN
  6.  
  7. call update_closingstk(upload_date);
  8.  
  9. END$$
  10.  
  11. DELIMITER ;$$


----- stored procedure 2 -------------

Expand|Select|Wrap|Line Numbers
  1. DELIMITER $$;
  2.  
  3. DROP PROCEDURE IF EXISTS `update_closingstk`$$
  4. CREATE PROCEDURE `update_closingstk`(upload_date varchar(10))
  5. BEGIN
  6.  
  7. declare clsstock int default 0;
  8.  
  9. set clsstock = get_closing_stk
  10.  
  11. END$$
  12.  
  13. DELIMITER ;$$


--- Function 1--------------

Expand|Select|Wrap|Line Numbers
  1. DELIMITER $$;
  2.  
  3. DROP FUNCTION IF EXISTS `scm_db`.`get_closing_stk`$$
  4.  
  5. CREATE FUNCTION `get_closing_stk`(upload_date varchar(10),productrid int ,pkt2cbb2 int) RETURNS int(11)
  6. BEGIN
  7. declare closingstock int;
  8. select clsstock into closingstock from clsstk_tab where stk_prod_rid=10;
  9.  
  10. return IFNULL(closingstock ,0);
  11. END$$
  12.  
  13. DELIMITER ;$$
Jan 25 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Please change your stored function in the below mentioned way:

---------------------------------------------

DELIMITER $$
DROP FUNCTION IF EXISTS `DEMO`$$
CREATE FUNCTION `DEMO`(upload_date varchar(10),productrid int ,pkt2cbb2 int(11))
RETURNS int(11)
BEGIN
declare closingstock int;
select IF(COUNT(clsstock) > 0, clsstock, 0) into closingstock from clsstk_tab where stk_prod_rid=10;

return closingstock;
END $$

DELIMITER

---------------------------------------------

It will solve your problem
Sep 30 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.