Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Same DBI query gives different results on 32 & 64 bit boxes

by cenobite1066 (Novice)
on May 29, 2009 at 16:48 UTC ( [id://766890]=perlquestion: print w/replies, xml ) Need Help??

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

Blessed Monks, I have used DBI to execute a fairly complex SQL query via ODBC on an Oracle database, and it's run without a hitch for years on a 32-bit XP box (Perl v5.6.1) Now I'm migrating the exact same query to a 64-bit XP server(Perl v5.10, 64bit), and the results are different. It seems that certain fields, almost all certainly ints/floats, are now returning zero instead of the expected values. All other string/date fields return OK, it's just numbers that come back as zero. It's not a problem with the DB as the 32-bit query still runs OK. Is there any difference in the type interpretation of the later 64-bit DBI/DBD code? Also, any SQL based tips are appreciated Thanks

SOLVED

Thanks Tye, CAST(field as VARCHAR(50)) retrieves each problem field correctly.

Appreciate the help.

  • Comment on Same DBI query gives different results on 32 & 64 bit boxes

Replies are listed 'Best First'.
Re: Same DBI query gives different results on 32 & 64 bit boxes (types)
by tye (Sage) on May 29, 2009 at 16:57 UTC

    Turn up the trace to determine if the problem is an ODBC bug or a DBD bug. Try typecasting your values to different data types. For ODBC, the client indicates what type of variable is available to stuff a given value into and ODBC decides how to convert to that type of value so switching datatypes might avoid the bug.

    In particular, change your query to return these numeric columns as strings instead (using convert() or cast() or similar). Perl will not have a problem turning the string into a number without you even having to do extra work.

    File a bug against DBD::ODBC.

    - tye        

Re: Same DBI query gives different results on 32 & 64 bit boxes
by Errto (Vicar) on May 29, 2009 at 18:29 UTC

    What ODBC driver are you using? How have you configured it?

    Have you tried DBD::Oracle?

    Do the versions of DBI and DBD::ODBC match on the new servers? Can you try the later Perl in the 32-bit environment?

Re: Same DBI query gives different results on 32 & 64 bit boxes
by tilly (Archbishop) on May 29, 2009 at 20:33 UTC
    The only SQL tip that I can think of is, "Try to create a cut down version of the bug." Just start finding chunks of SQL that can be removed, and remove them until you find out exactly what is necessary to reproduce the bug.

    This will lead to a much clearer bug report, and also a clear idea of what you need to do to work around the problem in the meantime.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://766890]
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 04:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found