MySQL Forums
Forum List  »  Stored Procedures

no more PREPARE and EXECUTE statement in stored procedure
Posted by: Stéphane De Blois
Date: July 18, 2005 02:45PM

i know in Mysql 5.0.9 no more PREPARE and EXECUTE statement is allowed. How you'r gone execute a stored procedure with an input parameter which it's used to build a dynamic SQL query .


CREATE PROCEDURE `bd`.`test`( IN pcustomerid int())
BEGIN
declare where_condition varchar(1000);

if(pcustomerid >0)
set where_condition = concat(' where customerid = ', pcustomerid);
else
set where_condition = '';

set @str_sql = concat('Select * From my_view', where_condition )

PREPARE stm_str_sql FROM @str_sql;
EXECUTE stm_str_sql;

in MySQL 5.0.9 i got this message : PREPARE is not allowed in stored procedurer

Options: ReplyQuote


Subject
Views
Written By
Posted
no more PREPARE and EXECUTE statement in stored procedure
8841
July 18, 2005 02: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.