DBI/SQL question



I have a large array of numbers that I need to use in an update SQL
statement using a "like" clause.

my @nums = ( 123 456 789 ); # it is much larger

foreach my $num (@nums) {
$dbh->do(q{update table_name set item_desc1 = item_desc2 where
equip like # I draw a blank here
}

I am not sure how to use the $num in a like since a like is '%' and it
I do '%$num' that won't be interpolated.

Help...

Robert

.



Relevant Pages

  • Re: DBI/SQL question
    ... foreach my $num { ... equip like # I draw a blank here ... I am not sure how to use the $num in a like since a like is '%' and it ... print q{equip like '%$num'}, "\n"; ...
    (comp.lang.perl.misc)
  • Re: Lazy evaluation?
    ... foreach $num { ... really sure if up to the point of lazy evaluation. ... The above (foreach list) *is* lazy evaluated (at least ... actually required for the printfunction which is not what perl does. ...
    (comp.lang.perl.misc)
  • Re: Lazy evaluation?
    ... foreach $num { ... does Perl use lazy evaluation? ...
    (comp.lang.perl.misc)
  • Re: Bidirectional mapping
    ... SAT SUN]? ... For quick and dirty and highly readable I usually do it like: ... foreach { ... set day_num($day) $num ...
    (comp.lang.tcl)
  • DBI/SQL question
    ... I have a large array of numbers that I need to use in an update SQL statement using a "like" clause. ... foreach my $num { ... equip like # I draw a blank here ... I am not sure how to use the $num in a like since a like is '%' and it I do '%$num' that won't be interpolated. ...
    (perl.beginners)