Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Overflow of $DBI::rows

by roboticus (Chancellor)
on Dec 07, 2012 at 16:29 UTC ( #1007781=note: print w/replies, xml ) Need Help??


in reply to Overflow of $DBI::rows

DanEllison:

I'd try one of two things: Either tell the database to explicitly use a larger numeric datatype in the hope that the driver will handle it:

select convert(numeric(15),count(*)) from ...

or failing that, have the database convert it to a string:

select convert(varchar(32),count(*)) from ...

I've never used Teradata, so I don't know if the syntax would need tweaking, but I'd expect a trick like this to get you to your goal.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: Overflow of $DBI::rows
by DanEllison (Beadle) on Dec 07, 2012 at 16:35 UTC
    I'm trying to avoid doing the separate SELECT COUNT(*). What we are performing is:
    my $sth = $dbh->prepare("UPDATE ...;") or die DBI::errstr; $sth->execute or die DBI::errstr; printf "Rows: %s\n", $sth->rows;
    and $sth->rows is returning a negative number.

      DanEllison:

      D'oh! Sorry about that. You were clear, I just had a brain glitch.

      I don't know a way to fix that, but I took a quick look at the ODBC Programmers Reference at msdn, and they're mentioning that the MDAC 2.7 ODBC libraries allow 64-bit values for the SQLLEN data type (used by SQLRowCount). If you're on a Windows platform, it might be sufficient to make sure you're using the latest ODBC libraries. (Of course, the Teradata end might still be using the 32 bit types, in which case you're probably out of luck.)

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007781]
help
Chatterbox?
[atcroft]: .oO(It is a well-known, well-tried module that has probably encountered more corner-cases and oddities than the average mortal programmer can imagine when trying to roll their own...)
[atcroft]: .oO(*Blah* It, I meant....)
[james28909]: omg
[james28909]: im just finding out that july and august have 31 days?
[atcroft]: stevieb: Apparently it was contagious....
[atcroft]: james28909: Make both hands into fists, place them together (with thumbs concealed), and every knuckle is a month (starting with Jan.) has 31 days, every dip (between knuckles) does not....
[atcroft]: (And Feb. is the odd case, because it is 28, unless it is a year divisible by 4, or if it is divisible by both 100 and 400 (at which point it is 29).)
[james28909]: i know but scroll through your calendar on your computer.
[james28909]: i thiught you were going to say make both hands into a fist and puch yourself in the face
[atcroft]: .oO(Sorry, I probably should have said take two normal hands....)

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2017-04-29 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (531 votes). Check out past polls.