DBD::ODBC does not support bind_param_inout?

DBD::ODBC does not support bind_param_inout?

am 18.07.2007 11:35:51 von hu.darren

Hi,
I have installed the DBD::ODBC from the latest svn.

when I want execute a procedure like this:

________
my $whoami = "";
my $csr = $dbh->prepare(q{
BEGIN
:whoami := PLSQL_EXAMPLE_DARREN.FUNC_NP;
END;
});
$csr->bind_param_inout(":whoami", \$whoami, 20);
$csr->execute;
print "Your database user name is $whoami\n";
$dbh->disconnect;
----------

but I failed with:

____________
/usr/bin/perl -w /home/darren/perl/dbitest.pl
Can't bind unknown placeholder ':whoami' at /home/darren/perl/dbitest.pl
line 90.
-------------

I have both used $dbh->{odbc_ignore_named_placeholders} = 1 and
$dbh->{odbc_ignore_named_placeholders} = 1

Any suggestions?

Re: DBD::ODBC does not support bind_param_inout?

am 19.07.2007 11:29:46 von Martin.Evans

hu.darren wrote:
> Hi,
> I have installed the DBD::ODBC from the latest svn.
>
> when I want execute a procedure like this:
>
> ________
> my $whoami = "";
> my $csr = $dbh->prepare(q{
> BEGIN
> :whoami := PLSQL_EXAMPLE_DARREN.FUNC_NP;
> END;
> });

I presume since that starts PLSQL you are using Oracle.
Which Oracle ODBC driver are you using?

What does the procedure look like?

Are you sure this is a procedure - procedures don't usually return
values (especially in oracle).

The ODBC syntax to call a procedure is:

{call proc_name(?,?...)}

You are better using that.

Having said procedures don't usually return values MS SQL Server can
return an integer in which case you can use:

{? = call procname(?,?,...)}


> $csr->bind_param_inout(":whoami", \$whoami, 20);
> $csr->execute;
> print "Your database user name is $whoami\n";
> $dbh->disconnect;
> ----------
>
> but I failed with:
>
> ____________
> /usr/bin/perl -w /home/darren/perl/dbitest.pl
> Can't bind unknown placeholder ':whoami' at /home/darren/perl/dbitest.pl
> line 90.
> -------------
>
> I have both used $dbh->{odbc_ignore_named_placeholders} = 1 and
> $dbh->{odbc_ignore_named_placeholders} = 1

These are the same aren't they!

> Any suggestions?

Why would you set odbc_ignore_named_placeholders - you are using named
placeholders so don't set it.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Re: DBD::ODBC does not support bind_param_inout?

am 01.08.2007 08:20:39 von bart.lateur

Sorry for the late reply, but I'm only scanning my inbox now.

On Wed, 18 Jul 2007 17:35:51 +0800, hu.darren wrote:

>my $csr = $dbh->prepare(q{
> BEGIN
> :whoami := PLSQL_EXAMPLE_DARREN.FUNC_NP;
> END;
> });

>but I failed with:

>Can't bind unknown placeholder ':whoami' at /home/darren/perl/dbitest.pl
>line 90.

>Any suggestions?

It's not an ODBC problem. You didn't declare the bind parameter in
Oracle. This would fail in SQL*plus too. Try

$dbh->prepare(q{
variable whoami varchar2(40);
});

first. (untested)

--
Bart.