Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OT : MySQL statement question



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>







BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org