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]
<[email protected]> 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 [mailto:[email protected]]
> 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
>