Hi folks.

I've just submitted the following as a 'bug' via the MySQL website, and was
wondering if anyone out there had experienced the same problem?

It only seems to cause a crash when a nested IF is put into a stored
procedure, so the work-around is obvious - don't nest 'em!


As posted to mysql.com:

Description: Using mysqld-opt on Windows 2000 Professional (5.0.0a-alpha),
and
the stored procedure shown below is created and called, the error: The
instruction at "0x00000000" referenced memory at "0x00000000". The memory
could
not be "read"

Is displayed, and the server shuts down 'unexpectedly'.

I have tried different permutations of the procedure, and it is the addition
of
a 'nested' if statement which triggers the problem - if this is removed, the
code will execute with no problems and give the expected result.

All tables referenced are InnoDB, and are simple tables with two columns (an
auto increment primary key and a unique indexed value column of type
VARCHAR(6)).

How to repeat:
>From the command line:

delimiter //
CREATE PROCEDURE name_test (OUT sFragment VARCHAR(6), OUT iRand INT)
BEGIN
DECLARE bContinue INT;
--DECLARE iRand INT;

SELECT 1 INTO bContinue;

WHILE bContinue = 1 DO

SELECT CAST((RAND() * 100)/33 AS UNSIGNED) INTO iRand;

IF iRand = 0 
THEN

SELECT Fragment INTO sFragment FROM namefragmentvowel ORDER BY RAND() LIMIT
1;

ELSE IF RAND = 1 THEN
SELECT Fragment INTO sFragment FROM namefragmentconsonant ORDER BY RAND()
LIMIT
1;

END IF;
END IF;

SELECT 0 INTO bContinue;

END WHILE;
END
//

Then from MySQLCC:

call name_test(@sTest, @iRand);
select @sTest AS frag, @iRand AS rng;


Cheers,


Matt



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to