Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: DBD::Oracle::st fetchrow_hashref failed: ORA-25401

by perldigious (Priest)
on Jan 30, 2020 at 16:34 UTC ( [id://11112110]=note: print w/replies, xml ) Need Help??


in reply to Re: DBD::Oracle::st fetchrow_hashref failed: ORA-25401
in thread RESOLVED - DBD::Oracle::st fetchrow_hashref failed: ORA-25401

In this case, it just seems to hang forever once it reaches this point in the execution. The script runs an earlier query just fine. I'm thinking it's something funky in the data that something in my Perl specific data pipeline is choking on. There are some funky things in the data of these particular tables, especially the "NOTE" data which I only read to strip a country name from the front of and throw away a bunch of junk on the end. Example of what I mean:

47 138 0 1O ARMENIA + AMFFFTTFTFXXXX XXXXX XX O X X TTFFFARM 48 138 0 1T ARUBA + AWFFFOFTTTXX X XXXXX X X O X TTFTTABW 49 138 0 1Y AUSTRALIA + AUFFFTFTTTX X XX OXXXXX XFFFFFAUS 50 138 0 23 AUSTRIA + ATFFFTTTTTX X XX X X OXXXXX XFFFTTAUT

Sometimes I get in over my head on stuff like this, especially when I'm largely ignorant about how to properly configure my tools to do what I think I might need or want.

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

Replies are listed 'Best First'.
Re^3: DBD::Oracle::st fetchrow_hashref failed: ORA-25401
by TieUpYourCamel (Scribe) on Jan 30, 2020 at 16:43 UTC
    Try removing columns from the query to see if one of them is causing the error. What are the data types of the columns?

      It runs fine when I leave out "NOTE" and "LOV_DISPLAY_KEY" which are VARCHAR2. The others are just NUMBER type.

      I'm guessing the issue is with the "NOTE" data. If I leave out just "NOTE", it runs and gets all the rows, but then hangs when it attempts to execute the sql again for a second time through a loop it's inside... I'm guessing that's an issue with my code and trying to do it in a loop that way, this is my first time attempting stuff like this so I'm still learning. A broader snip of my perl script:

      # establish database connection my $dsn = "dbi:Oracle:DWAPRD"; my $dbh = DBI->connect($dsn, $user, $pass); # execute "lov_table_lookup.sql" my $sth = $dbh->prepare($lov_table_sql); $sth->execute($note_filter, $name_filter); # print returned data and store table numbers in array my @table_numbers; print "\n----------\n"; while(my $row = $sth->fetchrow_hashref()) { print $row->{'TABLE_NUMBER'}, " ", $row->{'GLOBAL_SECTION_NAME'}, +" ", $row->{'NOTE'}, "\n"; push(@table_numbers, $row->{'TABLE_NUMBER'}); } print "----------\n"; # retrieve and print lov value list for each table number found foreach(@table_numbers) { my $row_counter = 1; # execute "lov_value_lookup.sql" my $sth = $dbh->prepare($lov_value_sql); $sth->execute($_); print "\n----------\n"; while(my $row = $sth->fetchrow_hashref()) { print "$row_counter ", $row->{'TABLE_NUMBER'}, " ", $row->{'LO +V_INTEGER_KEY'}, " ", $row->{'LOV_DISPLAY_KEY'}, " ", #$row->{'NOTE'}, "\n"; $row_counter++; } print "----------\n"; }

      And the error message I get in that case, which seems to be just telling me "hey dummy, you can't do that with a loop that way" or something of that nature:

      DBD::Oracle::db prepare failed: ORA-25408: can not safely replay call +(DBD ERROR: OCIStmtExecute/Describe) [for Statement "-- List all the +codes SELECT table_number , lov_integer_key , lov_display_key --, note FROM rdb_main.dk_lov_detail_rec WHERE table_number = ? ORDER BY table_number, lov_integer_key "] at lov_lookup.pl line 51. Can't call method "execute" on an undefined value at lov_lookup.pl lin +e 52.

      EDIT: Yes, it runs fine when I moved the prepare statement outside the loop (derp on my part), so the problem is presumably in the "NOTE" column data for those particular rows it's hanging on.

      Just another Perl hooker - My clients appreciate that I keep my code clean but my comments dirty.
        I had a similar issue with a "notes" field, and a workaround that seemed to work well was to convert the field and cap it:
        SELECT convert(VARCHAR(8000), a.Notes) as Notes ...
        In my case, Notes was a VARCHAR(MAX) data type, and my error message was "out of memory". (My database SQL Server, driver Sybase). You might try this or see what happens if you use:
        convert(VARCHAR(1), a.Notes)
        That would at least tell you if the error is coming from some crap data in that field, assuming the crap data isn't the first character. The above is "worth a shot" but I wouldn't be surprised if it doesn't reveal the problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11112110]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-18 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found