Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: ORA-911 during DBD::Oracle prepare

Re: ORA-911 during DBD::Oracle prepare

From: Mladen Gogala <mladen_at_wangtrading.com>
Date: Thu, 06 Nov 2003 14:44:32 -0800
Message-ID: <F001.005D5DD4.20031106144432@fatcity.com>


I tested named binds and they work. I should have read the #$%^! manual. Oh, well.

On 11/06/2003 05:29:31 PM, Mladen Gogala wrote:
> The problem are bind parameters. With DBI, you don't specify bind variables
> by name, you have to use positional binds. Your statement should read
> something like this:
> my ($usrenv,$ip,$osuser,$mach,$prog,$c1,$c2);
>
> $sth = $dbh->prepare(q{
> DECLARE
> usrenv vachar2(32) :=?;
> ip varchar2(17) :=?;
> osuser varchar2(32) :=?;
> mach varchar2(128) :=?;
> prog varchar2(128) :=?;
> c1 varchar2(128) :=?;
> c2 varchar2(128) :=?;
> BEGIN
> SELECT machine, program, SYS_CONTEXT(usrenv, ip),SYS_CONTEXT(usrenv, osuser)
> INTO mach,prog,c1,c2
> FROM v$session VS;
> END; ));
> # Now binding parameters.......
> $sth->bind_param_inout(1,\$usrenv,32);
> $sth->bind_param_inout(2,\$ip,17);
> $sth->bind_param_inout(3,\$osuser,17);
> $sth->bind_param_inout(4,\$mach,128);
> $sth->bind_param_inout(5,\$prog,128);
> $sth->bind_param_inout(6,\$c1,128);
> $sth->bind_param_inout(7,\$c1,128);
>
> In other words, the invalid character is ':'.
>
>
>
> On 11/06/2003 04:39:34 PM, "Quintin, Richard" wrote:
> > Don't you want SELECT machine, program, SYS_CONTEXT(?, ?),
> > SYS_CONTEXT(?, ?)...
> >
> > DBI uses positional binds as opposed to named binds.
> >
> > On Thu, 2003-11-06 at 16:29, Jesse, Rich wrote:
> > > Hey all,
> > >
> > > I'm trying to get a simple query running in Perl 5.6.1, DBI 1.30,
> > > DBD::Oracle 1.14, Oracle 8.1.7 on HPUX 11.0 talking to a 9.2.0.4 RAC DB on
> > > Linux (whew!). Here's the pertinent part of the code:
> > >
> > > #!/usr/bin/perl -w
> > >
> > > use strict;
> > > use DBI;
> > > use DBD::Oracle qw(:ora_types);
> > >
> > > my ($dbh, $sth);
> > >
> > > $dbh = DBI->connect("dbi:Oracle:mysid","myuser","mypass");
> > >
> > > $sth = $dbh->prepare(q{
> > > SELECT machine, program, SYS_CONTEXT(:userenv, :ipaddress),
> > > SYS_CONTEXT(:userenv, :osuser)
> > > FROM v$session VS;
> > > });
> > >
> > > At this point, I get an "ORA-911: invalid character" on the prepare. I
> > > thought perhaps the "$" was hosing me in "v$session", so I tried escaping it
> > > to "v\$session" (along with the underscores and parens) and using "qq"
> > > instead of "q", but to no avail.
> > >
> > > I knew I shouldn't have unsub'd from the DBI mailing list...
> > >
> > > Anyone?
> > > TIA,
> > > Rich
> > >
> > > Rich Jesse System/Database Administrator
> > > rjesse_at_qtiworld.com Quad/Tech Inc, Sussex, WI USA
> > > --
> > > Please see the official ORACLE-L FAQ: http://www.orafaq.net
> > Richard Quintin, DBA
> > Information Systems & Computing, DBMS
> > Virginia Tech
> > --
> > "If you would stand well with a great mind, leave him with a favorable
> > impression of yourself; if with a little mind, leave him with a
> > favorable impression of himself." -- Samuel Taylor Coleridge
> > --
> > Please see the official ORACLE-L FAQ: http://www.orafaq.net
> > --
> > Author: Quintin, Richard
> > INET: rquintin_at_vt.edu
> >
> > Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> > San Diego, California -- Mailing list and web hosting services
> > ---------------------------------------------------------------------
> > To REMOVE yourself from this mailing list, send an E-Mail message
> > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> > the message BODY, include a line containing: UNSUB ORACLE-L
> > (or the name of mailing list you want to be removed from). You may
> > also send the HELP command for other information (like subscribing).
> >
>
> Mladen Gogala
> Oracle DBA
>
>
>
> Note:
> This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks.
> Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity.
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Mladen Gogala
> INET: mladen_at_wangtrading.com
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>

Mladen Gogala
Oracle DBA

Note:
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Mladen Gogala
  INET: mladen_at_wangtrading.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Nov 06 2003 - 16:44:32 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US