473,394 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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
1 13965
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

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

Similar topics

6
by: Ken | last post by:
When running a program in the debugger, what would cause it to crash without any error messages? I get "The program has exited with code 0 (0x0)". The program is a MDI app with threading for...
10
by: Sonnich | last post by:
Hi all! I am (still) running some tests (dispite my problems), and I'd like to know the size of data I have in order to calculate growth. As a test I added some data, 1.69 Gb to be exact to a...
3
by: Ifoel | last post by:
Hi all pls help me How to know "HOW MANY SECOND" we fetched the rows of the record MySQL via Visual Basic 6...? Sample: 321 rows Fetched in 0,234s -> i need this field to load on the FORM...
4
by: Chronictank | last post by:
Hi, as a bit of background (and seeing as it is my first post :)) i am a complete newbie at perl. I literally picked it up a week ago to do this project as it seemed like the best choice for a...
0
by: preejith | last post by:
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...
4
by: getmeidea | last post by:
Hi all, I have run a batch file contains, mysql -uroot -proot -Dsample_db < "create_sp.sql" The "create_sp.sql" file contains definition for the stored procedure by the name...
2
by: kya2 | last post by:
I am not able to create following store procedure. CREATE PROCEDURE DBSAMBA.InsertDeleteBatch(OUT norows INT ) RESULT SETS 1 LANGUAGE SQL BEGIN part1 DECLARE TOTAL_LEFT INT DEFAULT 0; ...
45
by: angelicdevil | last post by:
i have 2 tables 1 is status_type with field name status and other is users with field username and status now i want that the first listbox lists all status from status type ( this i have achieved...
2
by: kkshansid | last post by:
this is my search page on which i am getting two parameters from previous page but the problem is that as soon as i click any other next pages my sql query fails as it doesnt get these two parameters...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.