MySQL Forums
Forum List  »  Stored Procedures

Stored Procedure Returning Multiple Rows
Posted by: marc jeeves
Date: November 30, 2019 12:45PM

I'm trying to write a stored procedure that will call another stored procedure that generated a unique key (this is working fine) , but i get an error message about multiple rows, how can i change my procedure below to make it work?

Thanks Madaxe

BEGIN
DECLARE next_val int(11);
DECLARE i int;

CREATE TEMPORARY TABLE lekodata.TempTable (objectid int);

SET i = 1;

loop_loop: LOOP

SET i = i + 1;
IF i <= NumberOfObjectIDs THEN
INSERT INTO lekodata.TempTable SELECT lekodata.NextObjectID(1);
ITERATE loop_loop;
END IF;
LEAVE loop_loop;

END LOOP loop_loop;


SELECT count(*) FROM lekodata.TempTable into next_val;

DROP TEMPORARY TABLE lekodata.TempTable;

RETURN next_val;
END

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored Procedure Returning Multiple Rows
3464
November 30, 2019 12:45PM


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.