I have a problem in my condition in the following where
clause (on the last line):
create procedure getSubjects(IN excludeName VARCHAR(255))
begin
select *
from subject
where excludeName = '' or subject.name not rlike excludeName;
end
No error is reported when I store the procedure, but I get ERROR 1139 (42000) at line 1: Got error 'empty (sub)expression' from regexp
whenever I call the procedure without empty parameters.
How can I write this clause?
Note:
I get the same error with the following syntax:
create procedure getSubjects(IN excludeName VARCHAR(255))
begin
select *
from subject
where
case excludeName
when '' then
subject.name rlike '.*'
else
subject.name not rlike excludeName
end;
end