http://www.perlmonks.org?node_id=11112044

perldigious has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Monks. I'm going to start by explaining my original problem (as this node is titled) to make sure I'm not doing the XY thing. This is my second day ever messing around with the Perl DBI, so I admit to all ignorance in advance and as always that I'm no power user of Perl in general.

I started getting the title error when attempting to retrieve some data from my employer's Oracle database. It seems to consistently hang on one of two rows as it's fetching them (it successfully retrieves many), then throws the error code. I think I can safely say the issue is with the script I've written, or not having set something up correctly, since I'm able to run the same query just fine in an SQL Developer environment using the same connection string. The code snip it's hanging on is pretty simple...

while(my $row = $sth->fetchrow_hashref()) { print $row->{'TABLE_NUMBER'}, " ", $row->{'LOV_INTEGER_KEY'}, +" ", $row->{'LOV_DISPLAY_KEY'}, " ", $row->{'NOTE'}, "\n"; }

I found this node of nearly the same title and attempted to follow the basic advice of updating my DBD::Oracle module install, but when I try that seems to be having a problem executing on my machine. Here's a screen dump of what's happening, not sure what I need to do here.

Configuring M/MJ/MJEVANS/DBD-Oracle-1.80.tar.gz with Makefile.PL Using DBI 1.642 (for perl 5.028001 on MSWin32-x64-multi-thread) instal +led in C:/Strawberry/perl/vendor/lib/auto/DBI/ Configuring DBD::Oracle for perl 5.028001 on MSWin32 (MSWin32-x64-mult +i-thread) If you encounter any problem, a collection of troubleshooting guides are available under lib/DBD/Oracle/Troubleshooting. 'DBD::Oracle::Troubleshooting' is the general troubleshooting guide, while platform-specific troubleshooting hints live in their labelled sub-document (e.g., Win32 hints are gathered in 'lib/DBD/Oracle/Troubleshooting/Win32.pod'). Installing on a MSWin32, Ver#10.0 Using Oracle in C:/Oracle/client/product/12.1.0/client_1 DEFINE _SQLPLUS_RELEASE = "1201000200" (CHAR) Oracle Version 12.1.0.2 (12.1) Found oci directory Using OCI directory 'oci' dlltool: unrecognized option `--input-def' Usage dlltool <options> <object-files> --machine <machine> --output-exp <outname> Generate export file. --output-lib <outname> Generate input library. --add-indirect Add dll indirects to export file. --dllname <name> Name of input dll to put into output lib. --def <deffile> Name input .def file --output-def <deffile> Name output .def file --base-file <basefile> Read linker generated base file --no-idata4 Don't generate idata$4 section --no-idata5 Don't generate idata$5 section -v Verbose -U Add underscores to .lib -k Kill @<n> from exported names --as <name> Use <name> for assembler --nodelete Keep temp files. Could not find or create liboci.a. Warning: No success on command[C:\Strawberry\perl\bin\perl.exe Makefil +e.PL] MJEVANS/DBD-Oracle-1.80.tar.gz C:\Strawberry\perl\bin\perl.exe Makefile.PL -- NOT OK

Any help any Monk can provide is much appreciated, at this point I'm running down random Google search holes that all seem to lead nowhere.

----------

UPDATE: For posterity's sake (and mine if I ever have to refer back)

Unfortunately I don't have a "root cause" as to why I was seeing this error, but I do at least seem to have a fix for it. When I added some CAST and TRIM functions around the the more exotic data fields all the problems went away. With just CAST they mostly went away, but it would still freeze up on occasion. The intermittent nature of the failures was/is the most disconcerting thing about them... inconsistency when running the same script with the same SQL was very vexing to me. I'm not even certain where exactly the problem was (The database? DBI? DBD::Oracle? My terminal?).

SELECT table_number , TRIM(CAST(global_section_name as CHAR(32))) as global_section_n +ame , TRIM(CAST(note as CHAR(80))) as note FROM rdb_main.dk_lov_header_rec WHERE note LIKE ? OR global_section_name LIKE ? ORDER BY global_section_name

SELECT table_number , lov_integer_key , TRIM(CAST(lov_display_key as CHAR(2))) as lov_display_key , TRIM(CAST(note as CHAR(30))) as note FROM rdb_main.dk_lov_detail_rec WHERE table_number IN (LIST_OF_LOV_TABLE_NUMBERS:?) ORDER BY table_number, note

I had gotten a bit sidetracked with a different issue that I wanted to resolve first since it was slowing down my debugging terribly.

Thank you to all the esteemed Monks who helped me get this figured out, it's very much appreciated:
choroba for his help getting my DBD::Oracle module updated when the install was failing for me.
pryrt for teaching me a quick tip to help me debug SYSTEM PATH issues.
marto for his tracing suggestion, perhaps someday I'll be less clueless and it will be useful to me :P.
TieUpYourCamel for leading me down the ultimately winning path of doing a little manual data massaging.

Now I'm off to pick more fights with the Perl DBI where I muddle the line between winning and losing. :-)

-------------------------------------------------

UPDATE - Resolved: See update at bottom of post here.

Just another Perl hooker - My clients appreciate that I keep my code clean but my comments dirty.