OT : MySQL statement question
tbs
tbs-Gb/NUjX2UK8 at public.gmane.org
Mon Nov 29 16:22:27 EST 2010
Hi folks,
well I have googled until my eyes are bleeding but cannot get a
definitive answer on this one ... Maybe someone here can help?
a 'requirements change' was requested from my upstream (them what pays
the checks). In a stored procedure where they can pass in a list if ID's
to identify a result set, they now want to be able to pass NO IDs and
get the list of all records with that field being null. :(
I am trying to avoid doing this :
IF (bool) THEN
large SQL Statement
ELSE
large SQL statement
ENDIF
for obvious reasons, the thought makes me shudder ...
What I was wondering is, can I do this :
select t.a, t.b, t.c, t.d
from table 't'
where
ta. = 'foo'
and t.b = 'bar'
IF (cond) THEN
AND isNULL(t.c)
ELSE
AND t.c in(vINPUTLIST)
ENDIF;
or am I just dreaming and it is not possible and I should shoot myself,
the upstream, or get busy copy and pasting ...
thanks for any pointers ...
richard
--
tbs <tbs-Gb/NUjX2UK8 at public.gmane.org>
More information about the Discuss
mailing list