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.
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |