Discussion:
help with odd DBI perpare/execute errors
William Bulley
2015-06-03 13:06:07 UTC
Permalink
Environment Perl script trying to query Oracle 11g database:

FreeBSD 9.3-STABLE

DBI 1.633

oracle8-client 0.2.0

DBD::Oracle 1.19

I have no trouble connecting with the Oracle database. And I do
recover data when I use the temporary workaround described below.

I have a query/prepare setup outside a foreach loop where I execute()
the prepared query something like this, only more complex:

my $query = "select column from table where column = ?";

my $sth = $dbh->prepare ($query);

foreach ()
{
$sth->execute($value);
}

I was getting invalid string ORA-0911 errors at the question mark.
I then replaced the question mark with a number (555) and made the
execute() call just "$sth->execute();"

This worked. But I really needed to bind to the $value variable
in the foreach loop.

In reading the DBI POD it said for Oracle the "?" is turned into
":p1" (in this case). So I replaced the question mark with :p1.

The prepare statement no longer generated an error, instead the
execute statement generated the error:

DBD::Oracle::st execute failed: called with 1 bind variables
when 0 are needed [for Statement ... ] at script.pl line xxx.

Can any one help me figure out this confusing situation? BTW, I
have been using Perl for twenty years and DBI for perhaps ten,
and I have used this query/prepare/bind/execute methodology in
the past with success. Something is different, but I don't know
what to look for.

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Martin J. Evans
2015-06-03 13:15:21 UTC
Permalink
Post by William Bulley
FreeBSD 9.3-STABLE
DBI 1.633
oracle8-client 0.2.0
DBD::Oracle 1.19
I have no trouble connecting with the Oracle database. And I do
recover data when I use the temporary workaround described below.
I have a query/prepare setup outside a foreach loop where I execute()
my $query = "select column from table where column = ?";
my $sth = $dbh->prepare ($query);
foreach ()
{
$sth->execute($value);
}
I was getting invalid string ORA-0911 errors at the question mark.
I then replaced the question mark with a number (555) and made the
execute() call just "$sth->execute();"
This worked. But I really needed to bind to the $value variable
in the foreach loop.
In reading the DBI POD it said for Oracle the "?" is turned into
":p1" (in this case). So I replaced the question mark with :p1.
Strictly speaking you do not need to do this - ? is fine. DBD::Oracle also supports named parameters e.g., ':myparam' which only has an advantage if you want to use :myparam more than once in the SQL.
Post by William Bulley
The prepare statement no longer generated an error, instead the
DBD::Oracle::st execute failed: called with 1 bind variables
when 0 are needed [for Statement ... ] at script.pl line xxx.
Either because you omitted the value from execute but more likely because you need to associate $value with the NAMED parameter i.e., call bind_param.
Post by William Bulley
Can any one help me figure out this confusing situation? BTW, I
have been using Perl for twenty years and DBI for perhaps ten,
and I have used this query/prepare/bind/execute methodology in
the past with success. Something is different, but I don't know
what to look for.
Regards,
web...
Tell us the column type of 'column' and the value of $value when the original code fails. If this does not enlighten you, reduce this to a small reproducible script and re-run with ora_verbose set to 7. Paste the output somewhere we can view it.

Martin
William Bulley
2015-06-03 13:38:08 UTC
Permalink
So, when this fails, what is the value of $value.
I just ran it again. The value is 547.
Assuming you have RaiseError set, you can just put an eval
I don't. I have a print statement in front of the execute to
show my what I am passing to the execute() method.
Strictly speaking you do not need to do this - ? is fine.
DBD::Oracle also supports named parameters e.g., ':myparam'
which only has an advantage if you want to use :myparam
more than once in the SQL.
The query is quite complex -- two SELECT statements connected
by a UNION statement -- and the "column = ?" syntax is used
twice. I changed the "?" to ":myparam" in both places and I
still get the error:

DBD::Oracle::st execute failed: called with 1 bind
variables when 0 are needed [for Statement...
Either because you omitted the value from execute
In this case, it was not omitted.
but more likely because you need to associate $value
with the NAMED parameter i.e., call bind_param.
That will be my next test, but I don't hold out much hope for
that working either (I've never had to do this in the past).
Tell us the column type of 'column' and the value of $value
when the original code fails. If this does not enlighten you,
reduce this to a small reproducible script and re-run with
ora_verbose set to 7. Paste the output somewhere we can view it.
The Oracle type for the column in question is NUMBER. I assumed
that any integer value would be compatible. The value is 547 for
the run that just failed.

Never heard of ora_verbose -- where is this to be set? Just in
my code somewhere, or on the DBI->connect() method, or where?

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Martin J. Evans
2015-06-03 13:48:30 UTC
Permalink
Post by William Bulley
So, when this fails, what is the value of $value.
I just ran it again. The value is 547.
Sounds ok but the error is "invalid string"

ORA-0911
You tried to execute a SQL statement that included a special character.

http://www.techonthenet.com/oracle/errors/ora00911.php
lists various causes.
Post by William Bulley
Assuming you have RaiseError set, you can just put an eval
I don't. I have a print statement in front of the execute to
show my what I am passing to the execute() method.
I'm not sure I'd trust that - doesn't that mean you are expecting stdin and stout to be in order. If you can easily do it I would stick an eval around it and trap it that way. Also, if you trap it you can print the SQL using
http://search.cpan.org/~timb/DBI-1.633/DBI.pm#Statement
and the parameters using
http://search.cpan.org/~timb/DBI-1.633/DBI.pm#ParamValues
Post by William Bulley
Strictly speaking you do not need to do this - ? is fine.
DBD::Oracle also supports named parameters e.g., ':myparam'
which only has an advantage if you want to use :myparam
more than once in the SQL.
The query is quite complex -- two SELECT statements connected
by a UNION statement -- and the "column = ?" syntax is used
twice. I changed the "?" to ":myparam" in both places and I
DBD::Oracle::st execute failed: called with 1 bind
variables when 0 are needed [for Statement...
Either because you omitted the value from execute
In this case, it was not omitted.
I would not bother changing from ? to named - I seriously doubt this is the issue.
Post by William Bulley
but more likely because you need to associate $value
with the NAMED parameter i.e., call bind_param.
That will be my next test, but I don't hold out much hope for
that working either (I've never had to do this in the past).
Tell us the column type of 'column' and the value of $value
when the original code fails. If this does not enlighten you,
reduce this to a small reproducible script and re-run with
ora_verbose set to 7. Paste the output somewhere we can view it.
The Oracle type for the column in question is NUMBER. I assumed
that any integer value would be compatible. The value is 547 for
the run that just failed.
Never heard of ora_verbose -- where is this to be set? Just in
my code somewhere, or on the DBI->connect() method, or where?
http://search.cpan.org/~pythian/DBD-Oracle-1.74/lib/DBD/Oracle.pm#ora_verbose

Can be set in the connect attributes.
Post by William Bulley
Regards,
web...
If I were you I'd try and simply the original case down as much as possible but getting a trace with ora_verbose might help identify the problem.

Martin
William Bulley
2015-06-03 13:57:22 UTC
Permalink
Post by Martin J. Evans
Sounds ok but the error is "invalid string"
ORA-0911
You tried to execute a SQL statement that included a special character.
http://www.techonthenet.com/oracle/errors/ora00911.php
lists various causes.
Yep, I've been all over the net looking for this issue. I am not
doing anything wrong -- the "invalid string" is the darn "?"!!!


DBD::Oracle::db prepare failed: ORA-00911: invalid character
(DBD ERROR: error possibly near <*> indicator at char 370 in '
select distinct s.ITEMIDNUM,
c.STATUSDES,
s.ADDRESS128BIT,
s.PREFIX_LEN,
s.ENDADDRESS128BIT,
s.CREATED_USER,
to_char(s.CREATED_DATE, 'YYYY-MM-DD HH24:MI:SS'),
i.ITEMDES,
i.COMMENTS,
s.RESERVEDFOR,
s.AGGREGATE_STATUS,
i.STATUSCD,
i.ITEMNAME
from UMNET_ONLINE.IP6NET s, UMNET_ONLINE.ITEM i, UMNET_ONLINE.STATUS_CODE c
where i.PARENTITEMIDNUM = <*>?
and i.ITEMIDNUM = s.ITEMIDNUM
and i.STATUSCD = c.STATUSCD
and i.ITEMCATCD like 'IPv6'
union
select distinct s.ITEMIDNUM,
c.ITEMRELTYPDES,
s.ADDRESS128BIT,
s.PREFIX_LEN,
s.ENDADDRESS128BIT,
s.CREATED_USER,
...'

You can see the error complaining about the question mark above.
There is a second question mark in the second select statement.
Post by Martin J. Evans
I'm not sure I'd trust that - doesn't that mean you are
expecting stdin and stout to be in order.
Yes, and they are.
Post by Martin J. Evans
If you can easily do it I would stick an eval around it and
trap it that way. Also, if you trap it you can print the SQL using
http://search.cpan.org/~timb/DBI-1.633/DBI.pm#Statement
and the parameters using
http://search.cpan.org/~timb/DBI-1.633/DBI.pm#ParamValues
I'll have to look into that. But recall this: I am not getting
to the execute() statement. The above error is on the prepare()
statment. This is so very confusing to me...
Post by Martin J. Evans
I would not bother changing from ? to named - I seriously doubt this is the issue.
And you can see from the above that the question mark is back
in the mix.
Post by Martin J. Evans
http://search.cpan.org/~pythian/DBD-Oracle-1.74/lib/DBD/Oracle.pm#ora_verbose
Can be set in the connect attributes.
Thanks. :-)
Post by Martin J. Evans
If I were you I'd try and simply the original case down as much as
possible but getting a trace with ora_verbose might help identify the problem.
Okay, I'll try that next.

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Bruce Johnson
2015-06-03 14:10:59 UTC
Permalink
Post by William Bulley
Yep, I've been all over the net looking for this issue. I am not
doing anything wrong -- the "invalid string" is the darn "?"!!!
Make sure your original $query is delimited by double quotes, not single.

if you do $sth->prepare(‘select column from table where column = ?’); you’ll get that error.

That’s the only way the ? would get past DBI, I’d think, which is what your oracle error seems to be indicating.


--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions d
Howard, Chris
2015-06-03 14:44:38 UTC
Permalink
Can you post a copy of your prepare statement?



-----Original Message-----
From: William Bulley [mailto:***@umich.edu]
Sent: Wednesday, June 03, 2015 7:57 AM
To: Martin J. Evans
Cc: dbi-***@perl.org
Subject: Re: help with odd DBI perpare/execute errors
Post by Martin J. Evans
Sounds ok but the error is "invalid string"
ORA-0911
You tried to execute a SQL statement that included a special character.
http://www.techonthenet.com/oracle/errors/ora00911.php
lists various causes.
Yep, I've been all over the net looking for this issue. I am not
doing anything wrong -- the "invalid string" is the darn "?"!!!


DBD::Oracle::db prepare failed: ORA-00911: invalid character
(DBD ERROR: error possibly near <*> indicator at char 370 in '
select distinct s.ITEMIDNUM,
c.STATUSDES,
s.ADDRESS128BIT,
s.PREFIX_LEN,
s.ENDADDRESS128BIT,
s.CREATED_USER,
to_char(s.CREATED_DATE, 'YYYY-MM-DD HH24:MI:SS'),
i.ITEMDES,
i.COMMENTS,
s.RESERVEDFOR,
s.AGGREGATE_STATUS,
i.STATUSCD,
i.ITEMNAME
from UMNET_ONLINE.IP6NET s, UMNET_ONLINE.ITEM i, UMNET_ONLINE.STATUS_CODE c
where i.PARENTITEMIDNUM = <*>?
and i.ITEMIDNUM = s.ITEMIDNUM
and i.STATUSCD = c.STATUSCD
and i.ITEMCATCD like 'IPv6'
union
select distinct s.ITEMIDNUM,
c.ITEMRELTYPDES,
s.ADDRESS128BIT,
s.PREFIX_LEN,
s.ENDADDRESS128BIT,
s.CREATED_USER,
...'

You can see the error complaining about the question mark above.
There is a second question mark in the second select statement.
Post by Martin J. Evans
I'm not sure I'd trust that - doesn't that mean you are
expecting stdin and stout to be in order.
Yes, and they are.
Post by Martin J. Evans
If you can easily do it I would stick an eval around it and
trap it that way. Also, if you trap it you can print the SQL using
http://search.cpan.org/~timb/DBI-1.633/DBI.pm#Statement
and the parameters using
http://search.cpan.org/~timb/DBI-1.633/DBI.pm#ParamValues
I'll have to look into that. But recall this: I am not getting
to the execute() statement. The above error is on the prepare()
statment. This is so very confusing to me...
Post by Martin J. Evans
I would not bother changing from ? to named - I seriously doubt this is the issue.
And you can see from the above that the question mark is back
in the mix.
Post by Martin J. Evans
http://search.cpan.org/~pythian/DBD-Oracle-1.74/lib/DBD/Oracle.pm#ora_verbose
Can be set in the connect attributes.
Thanks. :-)
Post by Martin J. Evans
If I were you I'd try and simply the original case down as much as
possible but getting a trace with ora_verbose might help identify the problem.
Okay, I'll try that next.

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
William Bulley
2015-06-03 14:19:07 UTC
Permalink
Post by Bruce Johnson
Make sure your original $query is delimited by double quotes, not single.
I've tried _everything_!!

Single quotes. Double quotes. q{} and qq{} (using the latter now).

But no matter what I try DBI complains about the darn question mark!

It is infuriating, I tell you! :-)
Post by Bruce Johnson
if you do $sth->prepare('select column from table where column = ?');
you'll get that error.
That's the only way the ? would get past DBI, I'd think, which is
what your oracle error seems to be indicating.
It is still not repsonding to any attempts to remedy the problem, sigh... :-(

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Bruce Johnson
2015-06-03 16:12:55 UTC
Permalink
Post by William Bulley
Post by Bruce Johnson
Make sure your original $query is delimited by double quotes, not single.
I've tried _everything_!!
Single quotes. Double quotes. q{} and qq{} (using the latter now).
But no matter what I try DBI complains about the darn question mark!
It is infuriating, I tell you! :-)
Well, I just tested MY theory (RHEL v6.5, oracle 11.2g, oracle instant client for 11.2, perl, v5.10.1 (*) built for x86_64-linux-thread-multi) with:

#!/usr/bin/perl
use strict;
use DBI;
my $dbh= DBI->connect(“dbi:Oracle:host=$host", $user, $pass, {RaiseError =>1});

my $qry1 ='select ? from dual';
my $qry2 = "select ? from dual";
my $sth = $dbh->prepare($qry1);
$sth->execute('foo');
my ($res)=$sth->fetchrow();
print "single quote result is $res \n";
$sth =$dbh->prepare($qry2);
$sth->execute('bar');
($res)=$sth->fetchrow();
print "double quote result is $res \n";
exit;

And got:
# ./qmarktest.pl
single quote result is foo
double quote result is bar

So yet another fine theory destroyed by reality…

Possibly some sort of character set mess up? Could your 'question mark' be something else in the script? Maybe a 16-bit vs 8-bit character? I’ve had some weird issues in the past when I was handed a 16-bit unicode text file of insert statements and tried to run them.

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group
Martin J. Evans
2015-06-03 16:16:26 UTC
Permalink
Post by Bruce Johnson
Post by William Bulley
Post by Bruce Johnson
Make sure your original $query is delimited by double quotes, not single.
I've tried _everything_!!
Single quotes. Double quotes. q{} and qq{} (using the latter now).
But no matter what I try DBI complains about the darn question mark!
It is infuriating, I tell you! :-)
#!/usr/bin/perl
use strict;
use DBI;
my $dbh= DBI->connect(“dbi:Oracle:host=$host", $user, $pass, {RaiseError =>1});
my $qry1 ='select ? from dual';
my $qry2 = "select ? from dual";
my $sth = $dbh->prepare($qry1);
$sth->execute('foo');
my ($res)=$sth->fetchrow();
print "single quote result is $res \n";
$sth =$dbh->prepare($qry2);
$sth->execute('bar');
($res)=$sth->fetchrow();
print "double quote result is $res \n";
exit;
# ./qmarktest.pl
single quote result is foo
double quote result is bar
So yet another fine theory destroyed by reality…
Possibly some sort of character set mess up? Could your 'question mark' be something else in the script? Maybe a 16-bit vs 8-bit character? I’ve had some weird issues in the past when I was handed a 16-bit unicode text file of insert statements and tried to run them.
Bruce,

Just so you know, I've already told William off list that question mark should not get through to Oracle and so the preparse method in DBD::Oracle is not spotting the ? - perhaps because it is not a ? or it thinks it is in a comment, literal etc. However, I expect, as you do, that one of the chrs in the SQL is not what it seems.

Sorry, as log file was sent to me I answered it and did not cc the list.

Martin
William Bulley
2015-06-03 15:14:22 UTC
Permalink
Post by Howard, Chris
Can you post a copy of your prepare statement?
Sure. Here it is:

$sth = $dbh->prepare ($query) or die "Couldn't prepare statement: " . $dbh->errstr;

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Howard, Chris
2015-06-03 16:30:22 UTC
Permalink
Thanks!
And what does $query contain?



-----Original Message-----
From: William Bulley [mailto:***@umich.edu]
Sent: Wednesday, June 03, 2015 9:14 AM
To: Howard, Chris
Cc: Martin J. Evans; dbi-***@perl.org
Subject: Re: help with odd DBI perpare/execute errors
Post by Howard, Chris
Can you post a copy of your prepare statement?
Sure. Here it is:

$sth = $dbh->prepare ($query) or die "Couldn't prepare statement: " . $dbh->errstr;

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Martin J. Evans
2015-06-03 16:38:28 UTC
Permalink
Post by William Bulley
FreeBSD 9.3-STABLE
DBI 1.633
oracle8-client 0.2.0
DBD::Oracle 1.19
It seems I missed this ^^^^^

A 9 year old DBD::Oracle. I can well believe the preparse code has changed or been fixed in all that time.

I've recommended William tries a newer version as I suspect the preparse code it failing since those ? should not get to Oracle.

Martin
William Bulley
2015-06-03 16:44:11 UTC
Permalink
Post by Howard, Chris
Thanks!
And what does $query contain?
That is the issue! Martin has worked with me off-line and clearly
the query contained some quote characters. I've attempted to either
remove those or quote them the DBI quote() way, but since some of
my columns have VARCHAR2 types, I must issue this sort of syntax in
my WHERE clause:

column LIKE 'something'

It can't be avoided. And since the basic structure of the "query"
is like this:

select distinct
column,
column,
column
from table, table, table
where column = ?
column = column,
column = column,
column LIKE 'something'
union
select distinct
column,
column,
column
from table, table, table
where column = ?
column = column,
column = column,
column LIKE 'something'

Note the two question marks. The first one passes muster, but the
second one is flagged as an error (invalid character):

DBD::Oracle::db prepare failed: ORA-00911: invalid character
(DBD ERROR: error possibly near <*> indicator at char 788 in'
<< snipped query here>>' at script.pl line xxx

Martin thinks the parsing in the dbd_preparse() function within the
dbdimp.c file (part of DBD::Oracle) has issues so that it cannot deal
with the second question mark given the preceding single quote(s).

It seems plausible, yet odd, to me, but it isn't my module. Perhaps
I have an older version? I dunno... :-(

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Howard, Chris
2015-06-03 17:09:20 UTC
Permalink
Yes, that is the issue.

I was hoping you could share the actual code
with us. But no problem. Sounds like you have
some good clues.

Using Oracle 8 client and ancient DBI libraries
probably isn't helping, but also seems unlikely to hurt.

I'm leaning toward the opinion of an invisible special character
of some sort embedded in your query string.
But I could be all wet.

Does it exhibit the same failure if you swap the selects
around the 'UNION' ?




-----Original Message-----
From: William Bulley [mailto:***@umich.edu]
Sent: Wednesday, June 03, 2015 10:44 AM
To: Howard, Chris
Cc: Martin J. Evans; dbi-***@perl.org
Subject: Re: help with odd DBI perpare/execute errors
Post by Howard, Chris
Thanks!
And what does $query contain?
That is the issue! Martin has worked with me off-line and clearly
the query contained some quote characters. I've attempted to either
remove those or quote them the DBI quote() way, but since some of
my columns have VARCHAR2 types, I must issue this sort of syntax in
my WHERE clause:

column LIKE 'something'

It can't be avoided. And since the basic structure of the "query"
is like this:

select distinct
column,
column,
column
from table, table, table
where column = ?
column = column,
column = column,
column LIKE 'something'
union
select distinct
column,
column,
column
from table, table, table
where column = ?
column = column,
column = column,
column LIKE 'something'

Note the two question marks. The first one passes muster, but the
second one is flagged as an error (invalid character):

DBD::Oracle::db prepare failed: ORA-00911: invalid character
(DBD ERROR: error possibly near <*> indicator at char 788 in'
<< snipped query here>>' at script.pl line xxx

Martin thinks the parsing in the dbd_preparse() function within the
dbdimp.c file (part of DBD::Oracle) has issues so that it cannot deal
with the second question mark given the preceding single quote(s).

It seems plausible, yet odd, to me, but it isn't my module. Perhaps
I have an older version? I dunno... :-(

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Bruce Johnson
2015-06-03 17:12:40 UTC
Permalink
Post by William Bulley
Martin thinks the parsing in the dbd_preparse() function within the
dbdimp.c file (part of DBD::Oracle) has issues so that it cannot deal
with the second question mark given the preceding single quote(s).
It seems plausible, yet odd, to me, but it isn't my module. Perhaps
I have an older version? I dunno... :-(
I have numerous constructions like yours in my scripts and they work just fine (and have for a very long time, I’m pretty sure prior to 2006 which is when 1.19 was released, so I don’t believe it’s your DBD::Oracle version )

Double check those single quotes, though, I’ve seen editors that try to sneak in ‘smart quotes’ and those’ll bollix you every time.

Here’s a quicky test:

#!/usr/bin/perl
use strict;

foreach my $i (qw (? ' " “ ” ‘ ’ )){
print "$i is ascii ".(ord $i)."\n"
}

exit;

This is what it produces:

dbdev2:~ johnson$ perl test
? is ascii 63
' is ascii 39
" is ascii 34
? is ascii 210
? is ascii 211
? is ascii 212
? is ascii 213

Note the displayed ‘?’’s….this is in my standard OSX terminal, which is a VT-100 emulator using UTF-8 as the text encoding.

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not
Howard, Chris
2015-06-03 17:19:28 UTC
Permalink
cat scriptname | od -bc | more



-----Original Message-----
From: Bruce Johnson [mailto:***@Pharmacy.Arizona.EDU]
Sent: Wednesday, June 03, 2015 11:13 AM
To: William Bulley
Cc: dbi-***@perl.org
Subject: Re: help with odd DBI perpare/execute errors
Post by William Bulley
Martin thinks the parsing in the dbd_preparse() function within the
dbdimp.c file (part of DBD::Oracle) has issues so that it cannot deal
with the second question mark given the preceding single quote(s).
It seems plausible, yet odd, to me, but it isn't my module. Perhaps
I have an older version? I dunno... :-(
I have numerous constructions like yours in my scripts and they work just fine (and have for a very long time, I’m pretty sure prior to 2006 which is when 1.19 was released, so I don’t believe it’s your DBD::Oracle version )

Double check those single quotes, though, I’ve seen editors that try to sneak in ‘smart quotes’ and those’ll bollix you every time.

Here’s a quicky test:

#!/usr/bin/perl
use strict;

foreach my $i (qw (? ' " “ ” ‘ ’ )){
print "$i is ascii ".(ord $i)."\n"
}

exit;

This is what it produces:

dbdev2:~ johnson$ perl test
? is ascii 63
' is ascii 39
" is ascii 34
? is ascii 210
? is ascii 211
? is ascii 212
? is ascii 213

Note the displayed ‘?’’s….this is in my standard OSX terminal, which is a VT-100 emulator using UTF-8 as the text encoding.

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions,
William Bulley
2015-06-03 17:22:07 UTC
Permalink
Post by Howard, Chris
I was hoping you could share the actual code
with us. But no problem. Sounds like you have
some good clues.
Using Oracle 8 client and ancient DBI libraries
probably isn't helping, but also seems unlikely to hurt.
I'm leaning toward the opinion of an invisible special character
of some sort embedded in your query string.
But I could be all wet.
Does it exhibit the same failure if you swap the selects
around the 'UNION' ?
My focus now is trying to install DBD::Oracle 1.74 from CPAN (from
April of 2014) on my system. Yes, I am using the Oracle 8 instant
client. What is confusing to me is why FreeBSD _still_ contains
DBD::Oracle 1.19 in their "ports" tree! After all these years!

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
p***@pair.com
2015-06-03 22:10:49 UTC
Permalink
in message <***@itcom245.staff.itd.umich.edu>,
wrote William Bulley thusly...
...
Post by William Bulley
My focus now is trying to install DBD::Oracle 1.74 from CPAN (from
April of 2014) on my system.
...
Post by William Bulley
What is confusing to me is why FreeBSD _still_ contains
DBD::Oracle 1.19 in their "ports" tree! After all these years!
Since it's maintainership was passed to ***@freebsd ...

r296145 | skv | 2012-05-07 05:42:51 -1000 (Mon, 07 May 2012) | 4 lines

Pass maintainership of almost of my "p5-*" ports to "perl@".

(I hope updating of them will be improved).


... DBD::Oracle has not been updated. (The updates that are there are
related to Ports infrastructure & build/install.)

Somebody needs to file a PR to update the port. (Tsk, tsk [0,1].)


- parv


[0] http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/

[1] https://bugs.freebsd.org/bugzilla/enter_bug.cgi?component=Individual%20Port%28s%29&product=Ports%20%26%20Packages

--
William Bulley
2015-06-04 12:21:25 UTC
Permalink
DBD::Oracle no longer supports Oracle client versions before 9.2
Try a version before 1.25 for 9 and 1.18 for 8! at ./Makefile.PL line 271.
and there is no oracle9-client port on FreeBSD.
Thanks. That makes sense. What doesn't make sense and begs the
following question is:

Why isn't there an oracle9-client port for FreeBSD?

Is this an Oracle issue? Is this a FreeBSD issue? Or what? Thanks!

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
William Bulley
2015-06-04 13:44:59 UTC
Permalink
My guess: no-one had the need, time and skills to fix it.
There's a newer linux-oracle-instantclient-sdk available in the
ports (10.2.0.3), and maybe it helps to compile and link a newer
DBD::Oracle.
I have that one (actually, those three), but they are nine
years old as well: 20061115_5 is coded into the ports name.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=157544
Thanks! :-)

Regards,

web...
--
/"\ ASCII RIBBON / William Bulley
\ / CAMPAIGN AGAINST /
X HTML E-MAIL AND / E-MAIL: ***@umich.edu
/ \ LISTSERV POSTINGS /

72 characters width template ----------------------------------------->|
Loading...