mje suggested on IRC that % might do something weird in there, so I browsed the SQL::Statement .pm's to see if % was dealt with special, but I saw nothing out of the ordinary.

Then I created file_01.csv and file_02.csv just to make sure that them missing would not cause the failure and I put some data in there:

$ cat file_01.csv Prefix,NumberRange,Chargeband pfx,1,4 $ qs f file_01 SCHEMA: merijn, TABLE: file_01 [/pro/3gl/CPAN/DBD-CSV/sandbox] select prefix, numberrange, chargeband from file_01 prefix|numberrange|chargeband ------------------------------ pfx |1 |4 $ cat file_02.csv Termination,Service,ChargeBand end,yes,4 $ qs f file_02 SCHEMA: merijn, TABLE: file_02 [/pro/3gl/CPAN/DBD-CSV/sandbox] select termination, service, chargeband from file_02 termination|service|chargeband ------------------------------- end |yes |4 $

and I removed the %-like stuff (the fact that the where doesn't match doesn't matter now):

$ cat inner.pl #!/pro/bin/perl use strict; use warnings; use DBI; my $dir = "."; my $eol = "\n"; my $sep = ","; my $dbh_match = DBI->connect ("dbi:CSV:", undef, undef, { f_dir => $dir, f_ext => ".csv/r", csv_eol => $eol, csv_sep_char => $sep, RaiseError => 1, PrintError => 1, }) or die "Cannot connect: " . $DBI::errstr; print STDERR "Using perl version $]\n"; print STDERR "Using DBI version $DBI::VERSION\n"; print STDERR "Using DBD::File version $DBD::File::VERSION\n"; print STDERR "Using SQL::Statement version $SQL::Statement::VERSION\n" +; print STDERR "Using Text::CSV_XS version $Text::CSV_XS::VERSION\n"; my $sth_match = $dbh_match->prepare (qq; CREATE TABLE new AS SELECT file_01.Prefix, file_01.NumberRange, file_02.Termination, file_02.Service, file_02.ChargeBand FROM file_01 INNER JOIN file_02 ON file_01.Chargeband = file_02.ChargeBand WHERE file_02.Termination LIKE 'something'; ); $sth_match->execute or die "Cannot execute: " . $sth_match->errstr (); DBI->trace (1); $dbh_match->disconnect;
$ perl inner.pl Using perl version 5.014001 Using DBI version 1.616 Using DBD::File version 0.40 Using SQL::Statement version 1.33 Using Text::CSV_XS version 0.82 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.ChargeBand FROM file_01 INNER JOIN file_02 ON file_01.Chargeband = file_02.ChargeBand WHERE file_02.Termination LIKE 'something'"] at inner.pl line 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.ChargeBand FROM file_01 INNER JOIN file_02 ON file_01.Chargeband = file_02.ChargeBand WHERE file_02.Termination LIKE 'something'"] at inner.pl line 33. Exit 22 $

FWIW WHERE file_02.Termination = 'end'; yields the same, so LIKE can be ruled out as possible cause.


Enjoy, Have FUN! H.Merijn

In reply to Re: "You passed 0 parameters where 1 required" error using DBD::CSV, an INNER JOIN, and a WHERE clause by Tux
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.