Re: Variables in stored procedure

2011-10-04 Thread luiz rodrigo mottin
yes 2011/10/4 Paul Nickerson > You need a space before the word VALUES > > -- > *From: *"Adam Gerson" > *To: *"luiz rodrigo mottin" > *Cc: *mysql@lists.mysql.com > *Sent: *Tuesday, October 4, 2011 6:00:24 PM >

Re: Variables in stored procedure

2011-10-04 Thread Adam Gerson
Thanks Luiz, That got me closer. I was able to save the stored proc. It should be execute stm; not execute @sql; right? I get this when I try to execute it: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''

Re: Variables in stored procedure

2011-10-04 Thread luiz rodrigo mottin
you can use: set @sql = concat( "INSERT INTO ", TABLENAME, "VALUES ('309', '0', 'statpress_mincap', 'edit_posts', 'yes')"); prepare stm from @sql; execute @sql; 2011/10/4 Adam Gerson > I am getting the error that "TABLENAME" does not exist. How do I get it to > substitute the value stored in TAB

Re: Variables in stored procedure

2011-10-04 Thread Peter Brawley
On 10/4/2011 4:20 PM, Adam Gerson wrote: I am getting the error that "TABLENAME" does not exist. How do I get it to substitute the value stored in TABLENAME, and not the literal string? See the manual page for PREPARE. PB - begin declare v_max int unsigned default 1; declare v_counter

Variables in stored procedure

2011-10-04 Thread Adam Gerson
I am getting the error that "TABLENAME" does not exist. How do I get it to substitute the value stored in TABLENAME, and not the literal string? begin declare v_max int unsigned default 1; declare v_counter int unsigned default 21; declare TABLENAME text; start transaction; while v_counter