Help for this page

Select Code to Download


  1. or download this
    select name,value from A where name in ('a','b','c','d','e')
    
  2. or download this
    # Make a quoted list of strings
    my @quoted_vals = map { "'$_'" } @var1;
    my $sth3 = $dbh->prepare("select name,value from A.database1 where nam
    +e in ("
             . join(",",@quoted_vals) . ")"
             ) or die "Can't prepare statement: $DBI::errstr";
    
  3. or download this
    select name,value from A where name in (?, ?, ?, ?, ?)
    
  4. or download this
    # Build SQL statement with question marks instead of values
    my $sth3 = $dbh->prepare("select name,value from A.database1 where nam
    +e in ("
    ...
    
    # Tell DBI to replace the question marks with the list of values
    $sth3->execute(@var1);