By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,665 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,665 IT Pros & Developers. It's quick & easy.

DBD::DB2 Bug - negative REAL causes Numeric value out of range

P: n/a
(copied to comp.databases.ibm-db2)

Greetings,

Settings:

DBD::DB2 v0.76
DBI v1.38
Perl v5.8.0
IBM DB2 ESE v8.1 sp 4
RedHat Linux 9

Problem:

I am doing DB2 access via perl DBI but have trouble with fetching negative REAL value:

i.e. SELECT X FROM TABLE FETCH FIRST ROWS ONLY;

In this case, X is "-1" and the query should return "-1". But instead I have this error message and no data retrieved:

[error] DBD::DB2::st fetchrow_array failed: [IBM][CLI Driver] CLI0111E Numeric value out of range. SQLSTATE=22003

The same SQL works fine in command line mode. As you may know, REAL is 4 byte single-precision float-point in DB2. The value can be:

zero, or
-3.402E+38 to -1.175E-37, or
1.175E-37 to -3.402E+38.

In DBD::DB2, it should map to SQL_REAL ($sth->{TYPE} returns data type 7). But instead, I haven't found anything in the module. It seems all the postive values of REAL work fine and so does any converted DOUBLE and CHAR. To prove this, I have tested these SQL statements:

SELECT abs(X) FROM TABLE FETCH FIRST ROWS ONLY;
SELECT double(X) FROM TABLE FETCH FIRST ROWS ONLY;
SELECT char(X) FROM TABLE FETCH FIRST ROWS ONLY;

All of them work properly with DBD::DB2. Thus I believe this is a BUG. Could anyone please advice?

Many thanks in advance,

Bing

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.