MySQL Forums
Forum List  »  Stored Procedures

prepared statement within stored procedure mysql
Posted by: Devashish Chourey
Date: September 27, 2012 02:07AM

Hi All,

I have created prepared statement within stored procedure. But when I execute procedure I got a error message says as "#1243 - Unknown prepared statement handler (auto_partition) given to EXECUTE"

Please let me know what is wrong with below procedure.

CREATE PROCEDURE auto_partition()
BEGIN
DECLARE _stmt VARCHAR(1024);
SET @l_SQL := CONCAT('ALTER TABLE tbl_location_history ADD PARTITION (PARTITION ', concat( 'Part_Y', year( now( ) ) , '_M', month( now( ) ) , '_W', week( now( ))+1), ' VALUES LESS THAN (TO_DAYS(\'', DATE_FORMAT(date_add(NOW(), interval 15 day),'%Y-%m-%d'), '\')));');
PREPARE _stmt FROM @l_SQL;
EXECUTE _stmt;
DEALLOCATE PREPARE _stmt;
END

Thanks in advance.

Thanks,
Deva

Options: ReplyQuote


Subject
Views
Written By
Posted
prepared statement within stored procedure mysql
12260
September 27, 2012 02:07AM


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.