[DB-SIG]3rd Post : rounded values returned by DCO2
Peter Mott
peter at monicol.co.uk
Tue May 25 11:15:51 EDT 2004
SELECT DISTINCT VALEUR/2
Does it truncate with VALEUR instead of VALEUR/2?
Peter
At 15:44 25/05/2004, Benjamin DULON wrote:
>PYTHON CODE :
>
>def Test():
>
>
> sRetour = ''
> try:
> db = DCOracle2.connect(connect_string)
> c = db.cursor()
> strSQL = "SELECT DISTINCT VALEUR/2 FROM VM_SQLI_DONNEES WHERE
>NUMZONE='86160'"
>
>
> c.execute(strSQL);
>
>
> r = c.fetchall()
> sRetour = ''
> for entry in r:
> if entry[0] != None:
> sRetour += 'VALEUR=%s;@' % (entry[0])
>
>
> else: pass
>
>
> except (DCOracle2.DatabaseError, TypeError), e:
> sRetour = 'Erreur execution requete SQL:' + str(e)
>
>
> db.close()
> return sRetour
>
>CODE RETURNS :
> VALEUR=6.0;@VALEUR=1127.0;@VALEUR=1189.0;@
>
>CODE SHOULD RETURN :
> VALEUR=6.92;@VALEUR=1127.0;@VALEUR=1189.5;@
>
>If I change SQL request as " SELECT DISTINCT VALEUR FROM VM_SQLI_DONNEES
>WHERE NUMZONE='86160'" (VALEUR is not divided) then it returns :
> VALEUR=13.84;@VALEUR=2254;@VALEUR=2379;@
>
>TABLE DEFINITION :
> VALEUR VARVHAR2(255)
>
>With sqlplus, I have no problem.
>
>Thanks.
>
>Benjamin DULON.
>
> > I'm in trouble ! I can't understand what happening. I retrieve data
> > from Oracle 8i database, throw DCO2 using python, and I get every
> > values rounded to the nearest integer with a precision of one : 3,97
> > --> 4.0 4 --> 4.0
> > 4.12 --> 4.0
> >
> > Please help me I have already send 2 emails to [DB-SIG] mailing list
> > with no success ... I don't know what I can do now ...
> >
> > Operating System : Linux
> > Distribution : Red Hat 9
> > Python Version : 2.2.1
> > Oracle Version : 8.1.7
> > DCO2 : 1.2
> >
> > Find attached DCO2TRACELOG file.
>
>The attachment didn't make it.
>
>What we would need to help you, though, is (a) the schema (table
>definition) and (b) the Python code you are using. Without these
>nobody can help you.
>
>--Guido van Rossum (home page: http://www.python.org/~guido/)
>
>_______________________________________________
>DB-SIG maillist - DB-SIG at python.org
>http://mail.python.org/mailman/listinfo/db-sig
More information about the DB-SIG
mailing list