Re: [cx-oracle-users] Invalid Number error when updating a NUMBER field using parameter subsitition
Brought to you by:
atuining
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-13 06:03:56
|
I was thinking maybe the numeric value was passed in as string so I cast it to integer just to be assured. However, it still gives me the same error. >>> a.execute("update USERS set USER_LOGIN_FAILURE_ATTEMPT = :2 where USER_ID = :1", ('ftcs', int(1))) Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-01722: invalid number Regards, Wah Meng ________________________________ From: Wong Wah Meng-R32813 Sent: Thursday, October 13, 2011 1:43 PM To: 'cx-...@li...' Subject: Invalid Number error when updating a NUMBER field using parameter subsitition Hello guys, Can anyone advise why am I hitting invalid number error when trying to update a NUMBER field using parameters? The first SQL update works, however, not the second one. Is there a different way I need to pass to cx_Oracle if the parameter were a NUMBER field? SQL 1 (successful) >>> a.execute("update USERS set USER_LOGIN_FAILURE_ATTEMPT = 1 where USER_ID = 'ftcs'") SQL 2 (failed) >>> a.execute("update USERS set USER_LOGIN_FAILURE_ATTEMPT = :2 where USER_ID = :1", ('ftcs', 1)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/EComponent.py", line 821, in __call__ self._method, args, kw ) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1779, in _genericInvocation reply = self._requestReply( replyBit, (method_name, args, kw) ) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1612, in _requestReply reply = self._postReceive(reply) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1748, in _postReceive raise ValueError(post_msg[1]) # raise application-level exception ValueError: ORA-01722: invalid number USER_LAST_PW4_CHANGE DATE USER_OLD_PW5 VARCHAR2(30) USER_LAST_PW5_CHANGE DATE USER_LOGIN_FAILURE_ATTEMPT NUMBER REASON VARCHAR2(64) USER_LOGIN_FAILURE_REASON VARCHAR2(64) USER_LAST_LOGIN_DATE DATE USER_HR_DEPT VARCHAR2(10) Regards, Wah Meng |