Home: Perl Programming Help: Intermediate:
Wild Card params



pra_perl
Novice

Jun 30, 2015, 10:46 AM


Views: 2974
Wild Card params

Hi All,

I have a perl-Vertica question.

I need to pass a combination of a wild card and complete value of a field. It will be a combination of prefix and others.

The example is ('A','BCD-UT1','MDO-CT1').

The actual value of A is ABC-EF2.But users can just click on Prefix,A to get all values starting with A.

I tried,

if ($clnm ne ""){
$cnt = @parts = split(/\,/, $ clnm );
$clnm = "'";
for ($i = 0; $i < $cnt; $i++) {
$clnm = $clnm . $parts[$i];
($clnm = $clnm . "%','") if ($i < $cnt - 1);
}
$clnm = $clnm . "%'";
}
and then used it in

if ($clnm ne "") { $Where = $Where . "AND m.CLNAME LIKE $clnm % OR m.CLNAME IN ($clnm ) "; }.

It is not working.


The SQL either takes LIKE('A%') or IN ('ABC-EF2','BCD-UT1','MDO-CT1'), but not the combination.

How to retrieve the value,('A','BCD-UT1','MDO-CT1')?

Thanks,

pra_perl