Hi,

Sapdb 7.3.018-000-081-115
Windows XP Professional
Python 2.1.1
sapdb.pyd dated 02/11/2001 built with debug inf. size 862kb (containing fix
for resultset iterator)

I'm getting some strange division by zero behaviour when I execute the
following select from python. The division by zero is generating an answer
of 1.6565656565656562e+062.

>>> stmt = 'select sum(sp.spend), sum(sp.responses), sum(sp.spend) /
sum(sp.responses) from dbo.spots sp, dbo.saleshouses sh, dbo.stations st
where sp.cmpno = 1 and sp.stno = st.stno and st.shno = sh.shno group by
sh.name, dayname(sp.spdate) order by sh.shno, dayofweek(sp.spdate)'
>>> rs = sess.sql(stmt)
>>> rs[5]
(115.17999999999999, 0.0, 1.6565656565656562e+062)

If I run the same query in SQL Studio, I get a null value returned (I'd like
the option to have zero returned - is that possible?)

If I hard code the values into the select in python I get an empty string.

>>> stmt = 'select 115.17999999999999, 0.0, 115.17999999999999 / 0.0 from
dbo.spots sp, dbo.saleshouses sh, dbo.stations st where sp.cmpno = 1 and
sp.stno = st.stno and st.shno = sh.shno group by sh.name, dayname(sp.spdate)
order by sh.shno, dayofweek(sp.spdate)'
>>> rs = sess.sql(stmt)
>>> rs[5]
('115.17999999999999', 0, ' ')

Thanks for any help,

Ray




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to