MySQL Forums
Forum List  »  Stored Procedures

Re: Passing Values
Posted by: Atanas Todorov
Date: October 27, 2005 05:29AM

if you have at least 5.0.13-rc, you can do this by using prepared statement:

delimiter //

create procedure `test`(in table_name varchar(50),in val1 int,in val2 varchar(255))
begin
set @val1 := val1;
set @val2 := val2;
set @insert_query := concat('insert into ', table_name, ' values (?,?)');
prepare stmt from @insert_query;
execute stmt using @val1, @val2;
deallocate prepare stmt;
end//

delimiter ;



Edited 1 time(s). Last edit at 10/27/2005 05:31AM by Atanas Todorov.

Options: ReplyQuote


Subject
Views
Written By
Posted
2624
October 27, 2005 02:17AM
Re: Passing Values
1809
October 27, 2005 05:29AM


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.