Have you tried replacing the question marks with named placeholders?
DBD::Oracle supports both and I'm pretty sure you can do an explain
plan with named placeholders.
Steve
On 21/04/2009, at 6:12 AM, E R wrote:Perhaps I should have divulged more of what I am already trying.
I am getting this error:
ORA-01036: illegal variable name/number (DBD ERROR: OCIBindByName)
[for Statement "EXPLAIN PLAN SET STATEMENT_ID = '21623' FOR SELECT *
FROM TRANSACTION_HISTORY WHERE ACCOUNT_ID = ?" with ParamValues:
:p1='v8799']
when I run this code:
my $prefix = "EXPLAIN PLAN SET STATEMENT_ID = '$$' FOR ";
my $sql = "SELECT * FROM TRANSACTION_HISTORY WHERE ACCOUNT_ID = ?";
my @params = qw(v8799);
...
my $esth = $dbh->prepare("$prefix$sql");
unless ($esth) {
die "prepare of EXPLAIN failed";
}
unless ($esth->execute(@params)) {
die "execute of EXPLAIN failed";
}
On Mon, Apr 20, 2009 at 2:42 PM, Nelson, Erick [HDS]
wrote:
Instead of a ? as a place holder, try using numeric place holders
(eg.
:1, :2...etc)
Example:
Select * from sfile where id = :1
-----Original Message-----
From: E R
Sent: Monday, April 20, 2009 12:25 PM
To:
[email protected]Subject: an explain plan for Oracle queries with placeholders
I'd like to perform an EXPLAIN PLAN on a query that has question mark
placeholders.
I've seen perl scripts which perform EXPLAIN PLAN commands, but the
queries they operate on don't have placeholders.
Any pointers on how I would go about doing this?
Thanks,
ER
This email is intended solely for the use of the addressee and may
contain information that is confidential, proprietary, or both.
If you receive this email in error please immediately notify the
sender and delete the email.