Hello!
How do I find a literal % with the LIKE-operator?
#!/usr/bin/perl
use warnings;
use strict;
use DBI;
my $table = 'formula';
my $dbh = DBI->connect ( "DBI:CSV:", undef, undef, { RaiseError => 1 } );
my $AoA = [ [ qw( id formula ) ],
[ 1, 'a + b' ],
[ 2, 'c - d' ],
[ 3, 'e * f' ],
[ 4, 'g / h' ],
[ 5, 'i % j' ], ];
$dbh->do( qq{ CREATE TEMP TABLE $table AS IMPORT ( ? ) }, {}, $AoA );
my $sth = $dbh->prepare ( qq{ SELECT * FROM $table WHERE formula LIKE '%[%]%' } );
$sth->execute;
$sth->dump_results;
# Output:
# 3, 'e * f'
# 1 rows