in reply to Bind param error
$sth1=$Dbh->prepare(...) or die "Prepare failed: $DBI::errstr\n";
I also usually try to define my SQL strings independently of the prepare statement to make the code more obvious. An example from some of my code, using a heredoc:
my $sql = <<EOSQL; INSERT INTO files (filename, content) VALUES (?,?) EOSQL my $query = $oracle->prepare($sql) or die "Insert prepare failed: $DBI::errstr"; $query->bind_param(1,$filename) or die "Insert bind_param failed: $DBI::errstr"; $query->bind_param(2,$content,{ora_type => ORA_BLOB}) or die "Insert bind_param failed: $DBI::errstr"; $query->execute or die "Insert execute failed: $DBI::errstr";
You can also accomplish something similar using the PrintError or RaiseError flags at connect; see DBI for details.
my $oracle = DBI->connect( @dbi_path, { PrintError => 0, RaiseError => 0, AutoCommit => 0 } ) or die "Database connect to $db_name failed:" . $DBI::errstr;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bind param error
by doug145 (Initiate) on Jun 30, 2010 at 20:21 UTC | |
by kennethk (Abbot) on Jun 30, 2010 at 20:44 UTC | |
by doug145 (Initiate) on Jul 01, 2010 at 20:34 UTC | |
by Corion (Patriarch) on Jul 01, 2010 at 20:38 UTC | |
by kennethk (Abbot) on Jul 02, 2010 at 13:17 UTC | |
by doug145 (Initiate) on Jul 02, 2010 at 20:42 UTC |