Yes this script is currently running under unix with no problems. That is
why I am stumped. But thank you both for the help.
-----Original Message-----
From: Steve Howard [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 3:40 PM
To: Brennan, Corey; [EMAIL PROTECTED]
Subject: RE: prepare_cached statement error???
You are saying this worked on Unix? I see one statement that I think should
be causing you problems with matching the numbers of parameters expected
with the number you have provided:
$sth->execute(@parm) or die ("$stmt Error\n");
That should be trying to execute with a single value: the length of @parm. I
doubt that's what you are after. Modify it like this:
$sth->execute(@parm[0..$#parm]) || die ("$DBI::ERRSTR\n");
(Thanks Michael Chase on this list for teaching me the $# notation)
You can also make your SQL statement a little more readable by using a qq{}
quote notation, and make it less susceptible to forgetting a back slash like
this:
$statement =qq{select description from t_system_symbols where
name_space = "COUNTRY" and value = ?};
And when all of that has been correct, I have still run into this error
message from Access (It has nothing to do with Windows or Perl...it's
Access). Sometimes I can get around this bug by going against everything
I've ever been taught and changing the select query to SELECT * FROM.....
However, when I say that, the only time I work with access is in a migration
off of access to another database system.
Hope this helps.
Steve H.
-----Original Message-----
From: Brennan, Corey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 12:32 PM
To: [EMAIL PROTECTED]
Subject: prepare_cached statement error???
Hi all,
I am having trouble getting a script ported over to NT from Unix. This
syntax works on the Unix side but when I try it on NT I get the following
error:
DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] Too
few parameters. Expected 3. (SQL-07001)(DBD:st_execute/SQL
Execute err=-1) at C:\Program Files\ipc\pricing_tool\maxgen\ESR_PwrReport.pl
line 257.
select description from t_system_symbols where name_space = "COUNTRY" and
value = ? Error
The code looks like this:
$statement =("select description from t_system_symbols where
name_space = \"COUNTRY\" and value = ?");
$row = &get_sql_data($statement, $country_temp);
$country = $row->[0];
sub get_sql_data {
my ($stmt, @parm) = @_;
my $sth = $dbh->prepare_cached($stmt) or die ("$stmt\n");
$sth->execute(@parm) or die ("$stmt Error\n");
my $row = $sth->fetchrow_arrayref();
undef $sth;
return $row;
}
Any help would be greatly appreciated.
Thanks in advance
---
Corey Brennan