So I could run your sample code I added a little code at the start:

... use DBI; unlink 'file_01.csv'; unlink 'file_02.csv'; unlink 'new.csv'; open my $oFile, '>', 'file_01.csv'; print $oFile "Prefix,NumberRange,ChargeBand\n"; close $oFile; open $oFile, '>', 'file_02.csv'; print $oFile "Termination,Service,ChargeBand\n"; close $oFile; my $dir = '.'; ... ) or die "Cannot connect: " . $DBI::errstr; print "DBI version: $DBI::VERSION\n"; print "DBD::CSV version: $DBD::CSV::VERSION\n"; print "SQL::Statement version: $SQL::Statement::VERSION\n"; my $sth_match = $dbh_match->prepare( ...

and got the following:

DBI version: 1.607 DBD::CSV version: 0.22 SQL::Statement version: 1.15 Use of uninitialized value in substitution iterator at C:/Perl/lib/SQL +/Parser.pm line 1596. DBI 1.607-ithread default trace level set to 0x0/1 (pid 4280) at n +oname1.pl line 48 <- disconnect= 1 at noname1.pl line 50 <- DESTROY(DBI::st=HASH(3c13f34))= '' <- DESTROY(DBI::db=HASH(3c12a54))= '' <- disconnect_all= undef at DBI.pm line 717 ! <- DESTROY(DBI::dr=HASH(3c124c4))= undef during global destruction

I'm using Perl 5.10.1 from ActiveState and after updating to the 'current' versions of the mentioned modules obtained:

DBI version: 1.616 DBD::CSV version: 0.31 SQL::Statement version: 1.33 DBD::CSV::st execute failed: You passed 0 parameters where 1 required +[for Statement " CREATE TABLE new AS SELECT file_01.Prefix, file_01.NumberRange +, file_02.Termination, file_02.Service, file_02.ChargeBa +nd FROM file_01 INNER JOIN file_02 ON file_01.Chargeband = file_02.ChargeBand WHERE file_02.Termination LIKE '%something%' "] at C:\Users\Peter\Delme~~\PerlScratch\noname1.pl line 46. DBD::CSV::st execute failed: You passed 0 parameters where 1 required +[for Statement " CREATE TABLE new AS SELECT file_01.Prefix, file_01.NumberRange +, file_02.Termination, file_02.Service, file_02.ChargeBa +nd FROM file_01 INNER JOIN file_02 ON file_01.Chargeband = file_02.ChargeBand WHERE file_02.Termination LIKE '%something%' "] at C:\Users\Peter\Delme~~\PerlScratch\noname1.pl line 46.

which starts to look like a bug introduced or revealed in the process of fixing another bug.

Interestingly switching to use a place holder in the like:

... WHERE file_02.Termination LIKE ? | ); $sth_match->execute('%something%') or die "Cannot execute: " . $sth_match->errstr(); DBI->trace(1); ...

generates the same error!

True laziness is hard work

In reply to Re: "You passed 0 parameters where 1 required" error using DBD::CSV, an INNER JOIN, and a WHERE clause by GrandFather
in thread "You passed 0 parameters where 1 required" error using DBD::CSV, an INNER JOIN, and a WHERE clause by planetscape

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.