MySQL Forums
Forum List  »  Newbie

Lost connection to Mysql server during query
Posted by: Paweł Kasprzak
Date: August 13, 2004 07:24AM

Hi!
I'm running on Mysql 5.0.alpha and I wrote a stored procedure as bellow:

CREATE procedure liczba_zwierz (IN p_za_id int,OUT wyj int)

BEGIN
DECLARE done INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;

DECLARE v_licznik int DEFAULT 0;

DECLARE v_d_urodzenia date;

DECLARE v_d_zbycia date;

DECLARE cu cursor for

select pob_data_urodzenia, pob_data_zbycia

from test.RGZ_POZYCJE_OBIEKTU,
test.RGZ_OBIEKTY_CHRONIONE,

test.RGZ_ZASWIADCZENIA

where za_id=och_za_id and

och_id=pob_och_id and

za_id =p_za_id and

och_f_typ_pozycji ='S';





open cu;

REPEAT

FETCH cu into v_d_urodzenia, v_d_zbycia;

IF NOT done THEN

IF v_d_urodzenia is null then

set v_licznik=v_licznik;

ELSE

set v_licznik=v_licznik+1;

END IF;

END IF;
UNTIL done END REPEAT;

close cu;

set wyj=v_licznik;

end

//
---------------------------------------------------
Colums pob_data_urodzenia, pob_data_zbycia in the decleared cursor are DATA type and only the column pob_data_urodzenia is filled. The column pob_data_zbycia in every record is NULL.
When I run the procedure it produces error message "Lost connection to Mysql server during query". If I fill both columns I can call procedure without problems.
Am I missing something. Any help would be appreciated


Options: ReplyQuote


Subject
Written By
Posted
Lost connection to Mysql server during query
August 13, 2004 07:24AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.