develooper Front page | perl.dbi.users | Postings from September 2004

nvarchar2 issues with DBD::Oracle 1.16RC7

Thread Next
From:
Jeff
Date:
September 22, 2004 05:45
Subject:
nvarchar2 issues with DBD::Oracle 1.16RC7
(I think it was RC7 - the one released end of august this year)

Originally I had an interesting problem - when I'd prepare a query
that called a function taking nvarchar2's as arguments it would work
on the first execution, but in subsequent executions Oracle would pass
NULL's for arguments to my functions.  I opened a TAR with Oracle about 
it
and was able to make it happen with plain OCI.   They discovered the 
problem
was I wasn't setting OCI_ATTR_CHARSET_FORM on my bind variables.  I put
this code in and it worked.  So I went back to DBD::Oracle to see how 
to do it.
(Since our app is in perl) I see I need to use 1.16, which is an RC, 
but 1.15
has zero support for this.

After some reading I tried it out, setting the csform value on the 
bind_param
call.  When I ran my test app I'd get "DBD::Oracle::st execute failed:
ORA-01460: unimplemented or unreasonable conversion requested (DBD 
ERROR:
error possibly near <*> indicator at char 51 in 'selec..." - Odd.  I 
put in
a bunch of debugging code into DBD and found it too was setting that 
attribute
so I'm a bit confused as to why it is happening. I cannot seem to make 
any
progress on this.

Useful Information:

This seems to happen on both perl 5.8.0 and 5.8.3
Client is Fedora Core 2 or RedHat 8 x86.
Oracle is 9.2.0.5 running on Solaris 64 bit.
Oracle Lib (linux) are 9.2.0.4
DB is in AL16UTF16
$NLS_LANG is American_America.WE8ISO8859P1


Steps to reproduce:
Load Schema into an AL16UTF16 (default in 9.2) DB:
http://www.jefftrout.com/~threshar/oracle/brokennvarchar.sql

Grab perl script:
http://www.jefftrout.com/~threshar/oracle/brokennvarchar.pl

Modify the DBI connect string accordingly.

then run it with the -broken argument. (The -broken, etc. arguments
used to be used to show my original bug in its various forms)

./brokennvarchar.pl -broken

You will likely see output along these lines:
DBD::Oracle::st execute failed: ORA-01460: unimplemented or 
unreasonable convers
ion requested (DBD ERROR: error possibly near <*> indicator at char 51 
in 'selec
t brokennvarchar.get_id_broken(:p1, :p2) from <*>dual') [for statement 
``select
brokennvarchar.get_id_broken(?, ?) from dual'' with params: 
:p1='thresharpd2', :
p2='potato']) at brokennvarchar.pl line 95.
execute failed: ORA-01460: unimplemented or unreasonable conversion 
requested (D
BD ERROR: error possibly near <*> indicator at char 51 in 'select 
brokennvarchar
.get_id_broken(:p1, :p2) from <*>dual')
DBD::Oracle::st fetch failed: ERROR no statement executing (perhaps you 
need to
call execute first) [for statement ``select 
brokennvarchar.get_id_broken(?, ?) f
rom dual'' with params: :p1='thresharpd2', :p2='potato']) at 
brokennvarchar.pl l
ine 105.
Failed to fetch ERROR no statement executing (perhaps you need to call 
execute f
irst)


And finally, a small C program using OCI to show it working properly:

http://www.jefftrout.com/~threshar/oracle/brokennvarchar.c

make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk build EXE=brokennv
archar OBJS=brokennvarchar.o

./brokennvarchar -b

you should see it successfully get ID "100" 5 times.
(If you run with -w you'll see it work the first time and fail the rest.
That was my original problem with the nvarchar's but now it affects the
regular varchar's. sigh)

Any pointers you could give me would be terrific!

--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About