Johnsi George
Programmer
sample:
Set @login='USC00010';
set @user='USC00010';
select STRCMP(@login,@user);//returns 0
if(STRCMP(@login,@user)= 0)
THEN
//process1
else
//process2
end if;
and the above code throws 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(STRCMP(@login,@user)= 0)
Actual requirement:
if(//matches)
begin
if exists(select X from X )
begin
if exists(select x from x where y=a)
begin
update x
end
end
else//doesn't match
begin
//process2
end
Set @login='USC00010';
set @user='USC00010';
select STRCMP(@login,@user);//returns 0
if(STRCMP(@login,@user)= 0)
THEN
//process1
else
//process2
end if;
and the above code throws 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(STRCMP(@login,@user)= 0)
Actual requirement:
if(//matches)
begin
if exists(select X from X )
begin
if exists(select x from x where y=a)
begin
update x
end
end
else//doesn't match
begin
//process2
end