Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Invalid literal for Decimal
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
V N  
View profile  
 More options Jun 9 2012, 10:30 pm
From: V N <vijay.n...@gmail.com>
Date: Sat, 9 Jun 2012 19:30:04 -0700 (PDT)
Local: Sat, Jun 9 2012 10:30 pm
Subject: Invalid literal for Decimal

Machine:  RHEL 5.3 x86_64 / Python 2.7.3 / pyodbc-3.0.3
Database: IBM Netezza TwinFin Appliance
ODBC:     NZ odbc client for Linux

Instance
    create table tst(a double, b numeric(9,4), c varchar(10), d char(4));
    insert into tst select 1.01, 1.01, 'aa', 'aa';

    select * from tst;
      A   |   B    | C  |  D
    ------+--------+----+------
     1.01 | 1.0100 | aa | aa

TEST
    import pyodbc
    conn = pyodbc.connect("DSN=vntest")
    cursor = conn.cursor()

Test 1
    cursor.execute("select a,c,d from tst")
    for row in cursor:
        print row

OUTPUT: (1.01, 'aa', 'aa  ')

Test 2
    cursor.execute("select b from tst")
    for row in cursor:
        print row

OUTPUT:
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/Python-2.7.3/lib/python2.7/decimal.py", line 548, in
__new__
        "Invalid literal for Decimal: %r" % value)
      File "/usr/local/Python-2.7.3/lib/python2.7/decimal.py", line 3866,
in _raise_error
        raise error(explanation)
    decimal.InvalidOperation: Invalid literal for Decimal: u''

I would appreciate any help with this.  Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vijay.n...@gmail.com  
View profile  
 More options Jun 9 2012, 10:36 pm
From: vijay.n...@gmail.com
Date: Sat, 9 Jun 2012 19:36:34 -0700 (PDT)
Local: Sat, Jun 9 2012 10:36 pm
Subject: Re: Invalid literal for Decimal

I can connect to the same db from windows and it seems to work:

Test 3:
cursor.execute("select a,b,c,d from tst")
for row in cursor:
   print row

OUTPUT:  (1.01, Decimal('1.0100'), 'aa', 'aa  ')


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce  
View profile  
 More options Jul 23 2012, 1:26 pm
From: Bruce <dangy...@gmail.com>
Date: Mon, 23 Jul 2012 10:26:46 -0700 (PDT)
Local: Mon, Jul 23 2012 1:26 pm
Subject: Re: Invalid literal for Decimal

I'm seeing this as well on SLES 11.2 linux 2.6.32, pyodbc 3.0.6, unixodbc
2.2.12, libnzodbc.so for Netezza client version 4.6.8.

Any word on this?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »