Skip navigation links

MySQL Forums :: Stored Procedures :: prepared statement within stored procedure mysql


Advanced Search

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 5342 Devashish Chourey 09/27/2012 02:07AM
Re: prepared statement within stored procedure mysql 1775 Peter Brawley 09/27/2012 08:05AM
Re: prepared statement within stored procedure mysql 1443 Devashish Chourey 09/27/2012 10:33PM
Re: prepared statement within stored procedure mysql 1379 Peter Brawley 09/28/2012 08:09AM
Re: prepared statement within stored procedure mysql 1356 Devashish Chourey 09/28/2012 08:44AM
Re: prepared statement within stored procedure mysql 1700 Yurii Korotia 09/30/2012 02:02PM
Re: prepared statement within stored procedure mysql 1140 Devashish Chourey 09/30/2012 11:33PM


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.