in reply to wild cards in Vertica

It looks like you have a space between $clnm and the %. In SQL "A %" will match A <space> anything. I think from you description you want "A%". Try

if ($clnm ne "") { $Where = $Where . qq(AND m.CLNAME LIKE '$clnm).qq(% +’ OR m.CLNAME IN ('$clnm') ); }.
--
“For the Present is the point at which time touches eternity.” - CS Lewis

Replies are listed 'Best First'.
Re^2: wild cards in Vertica
by pragov (Novice) on Jul 13, 2015 at 13:28 UTC
    Hi, I have this function as
    if ($clnm ne ""){ $cnt = @parts = split(/\,/, $clnm); # $clnm = "'"; $WHERE = $WHERE ." AND ("; for ($i = 0; $i < $cnt; $i++) { $WHERE = $WHERE . "m.CLNAME LIKE '$parts[$i]%' "; ($WHERE = $WHERE . " OR ") if ($i < $cnt - 1); } $WHERE = $WHERE . ")"; }
    How do I use this to get your statement if ($clnm ne "") { $Where = $Where . qq(AND m.CLNAME LIKE '$clnm).qq(% +’ OR m.CLNAME IN ('$clnm') ); }? Thanks