Given these routines:
create procedure getinfo(in input varchar(30), out isoption1 smallint,
out param1 mediumint)
        select isoption1, param1 from table1 where condition1=input;

create procedure getsource1data(in param1 mediumint, out outputA
varchar(30), out outputB varchar(60))
        select outputA, outputB from table2 where condition2=param1;

create procedure getsource2data(in param1 mediumint, out outputA
varchar(30), out outputB varchar(60))
        select outputA, outputB from table3 where condition3=param1;


Here's my supposed usage/implementation:
call getinfo('23466792737', @isopt1, @param1);
select @isopt1, @param1;
if (@isopt1=0) then
        call getsource1data(@param1, @outA, @outB);
else
        call getsource2data(@param1, @outA, @outB);
end if;
select  @outA, @outB;

The stored routine will have to decide based on the value of @isopt1
which stored routine the value of @outA and @outB will be from.

When I run these routines through the system via phpMyAdmin, the MySQL
server returns the following:
#1064 - 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 'if @isopt1=0 then
   call getsource1data(@param1, @outA, @outB

What's the problem with my routine codes? When I add parenthesis (i.e.
if (@isopt1=0)) as this is what some documentation suggests, I still
get the same error, making me think the parenthesis doesn't matter.
Your help will be greatly appreciated. Thank you very much!
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph

Reply via email to