MySQL syntax error in Stored Procedure -
what wrong stored procedure below? it's telling me there syntax error on if statement? i'm pulling hair out trying figure out. works fine if remove "create table" statement, , works fine if remove "if end if" statement!
create definer=`dbo514733022`@`%` procedure `si_proc1`(in `param1` int, in `param2` int) not deterministic reads sql data sql security definer create temporary table a(columna int); if 4 > 3 select * a; end if;
you have change delimiter character apart standard ;
since have multiple statements in procedure.
mysql thinks, procedure finished after create temporary...
statement, therefore syntax error. control structures if ... then
or while
not allowed in usual queries.
do this:
delimiter $$ create definer=`dbo514733022`@`%` procedure `si_proc1`(in `param1` int, in `param2` int) not deterministic reads sql data sql security definer create temporary table a(columna int); if 4 > 3 select * a; end if; end $$ /*this 1 ends procedure*/ delimiter ; /*don't forget change default*/
Comments
Post a Comment