On Mon, 28 Jun 2004, [gb2312] Lee Shang wrote:

> Hi 
>   i hava a db ORACLE 10G,a table valid_card
> (card_no,varchar2(10),now_balance number (12,2))
> 
>  its'some record in table ('7188','42055.66')
> 
>  i use cx_Oracle to select now_balance from table
>  
>   curobj.execute("select loan_amount from valid_card
> where
> card_no='7188'");
> [<NumberVar object at 0x013A6920>]
> >>> tuple=curobj.fetchone()
> >>> tuple
> (42505.660000000003)
> 
> why 42505.66---->42505.6600000000003???
> 
> and how to select number field from oracle?

Try this:

curobj.execute("""\
    SELECT CAST(loan_amount * 100 AS INTEGER)
      FROM valid_card
     WHERE card_no = '7188'""")
tuple = cursor.fetchone()
cents = tuple and tuple[0] or None

-- 
Bob Kline
mailto:[EMAIL PROTECTED]
http://www.rksystems.com

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to