Hi There, I was wondering if anyone has used the Stored Procedures in MySQL version 5.0.0-alpha. I have setup a MySQL server version 5.0 alpha and was trying out the stored procedures. I noticed some strange behaviour in using some of the function calls from within the stored procedures. I am facing problems mainly with LAST_INSERT_IDENITY() and MAX. For example tried the following
Step 1 ------ mysql>create table test ->( -> id int auto_increment primary key, -> name varchar(50) ->); Query OK, 0 rows affected (0.01 sec) mysql>Delimiter // Step 2 ------ CREATE PROCEDURE insert_test(SomeName varchar(50), OUT identity int) begin insert into test (id, name) values (Null, SomeName); -- select LAST_INSERT_ID() into identity; -- OR -- set identity = LAST_INSERT_ID(); end // Delimiter ; Step 3 ------ Call insert_test('Naresh', @a); Query OK, 0 rows affected (0.00 sec) Step 4 ------ Select @a; +------+ | @a | +------+ | NULL | +------+ 1 row in set (0.00 sec) Step 5 ------ Select * from test +----+--------+ | id | name | +----+--------+ | 1 | Naresh | +----+--------+ 1 row in set (0.00 sec) Simillary there is a problem with the max function also. Seems like that when the procedure is created at step 2 the value of LAST_INSERT_ID is calculated at that point and stored within the procedure defination. If after step 5 I were to drop the stored procedure and create it again, and run the step 3 and step 4 again, it will return the value 1 for the command "select @a". Any ideas? Comments? Is it a bug ...? Regards Naresh -- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message. This footer also confirms that this email message has been scanned for the presence of computer viruses. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of DA Group.
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]