cx-oracle-users Mailing List for cx_Oracle (Page 25)
Brought to you by:
atuining
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(9) |
Sep
(8) |
Oct
(12) |
Nov
(4) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(15) |
Feb
(12) |
Mar
(11) |
Apr
(5) |
May
(7) |
Jun
(8) |
Jul
(12) |
Aug
(2) |
Sep
(14) |
Oct
(17) |
Nov
(20) |
Dec
(3) |
2005 |
Jan
(16) |
Feb
(9) |
Mar
(22) |
Apr
(21) |
May
(73) |
Jun
(16) |
Jul
(15) |
Aug
(10) |
Sep
(32) |
Oct
(35) |
Nov
(22) |
Dec
(13) |
2006 |
Jan
(42) |
Feb
(36) |
Mar
(13) |
Apr
(18) |
May
(8) |
Jun
(17) |
Jul
(24) |
Aug
(30) |
Sep
(35) |
Oct
(33) |
Nov
(33) |
Dec
(11) |
2007 |
Jan
(35) |
Feb
(31) |
Mar
(35) |
Apr
(64) |
May
(38) |
Jun
(12) |
Jul
(18) |
Aug
(34) |
Sep
(75) |
Oct
(29) |
Nov
(51) |
Dec
(11) |
2008 |
Jan
(27) |
Feb
(46) |
Mar
(48) |
Apr
(36) |
May
(59) |
Jun
(42) |
Jul
(25) |
Aug
(34) |
Sep
(57) |
Oct
(97) |
Nov
(59) |
Dec
(57) |
2009 |
Jan
(48) |
Feb
(48) |
Mar
(45) |
Apr
(24) |
May
(46) |
Jun
(52) |
Jul
(52) |
Aug
(37) |
Sep
(27) |
Oct
(40) |
Nov
(37) |
Dec
(13) |
2010 |
Jan
(16) |
Feb
(9) |
Mar
(24) |
Apr
(6) |
May
(27) |
Jun
(28) |
Jul
(60) |
Aug
(16) |
Sep
(33) |
Oct
(20) |
Nov
(39) |
Dec
(30) |
2011 |
Jan
(23) |
Feb
(43) |
Mar
(16) |
Apr
(29) |
May
(23) |
Jun
(16) |
Jul
(10) |
Aug
(8) |
Sep
(18) |
Oct
(42) |
Nov
(26) |
Dec
(20) |
2012 |
Jan
(17) |
Feb
(27) |
Mar
|
Apr
(20) |
May
(18) |
Jun
(7) |
Jul
(24) |
Aug
(21) |
Sep
(23) |
Oct
(18) |
Nov
(12) |
Dec
(5) |
2013 |
Jan
(14) |
Feb
(10) |
Mar
(20) |
Apr
(65) |
May
(3) |
Jun
(8) |
Jul
(6) |
Aug
(3) |
Sep
|
Oct
(3) |
Nov
(28) |
Dec
(3) |
2014 |
Jan
(3) |
Feb
(9) |
Mar
(4) |
Apr
(7) |
May
(20) |
Jun
(2) |
Jul
(20) |
Aug
(7) |
Sep
(11) |
Oct
(8) |
Nov
(6) |
Dec
(12) |
2015 |
Jan
(16) |
Feb
(10) |
Mar
(14) |
Apr
(8) |
May
|
Jun
(8) |
Jul
(15) |
Aug
(7) |
Sep
(1) |
Oct
(33) |
Nov
(8) |
Dec
(5) |
2016 |
Jan
(18) |
Feb
(12) |
Mar
(6) |
Apr
(14) |
May
(5) |
Jun
(3) |
Jul
|
Aug
(21) |
Sep
|
Oct
(15) |
Nov
(8) |
Dec
|
2017 |
Jan
|
Feb
(14) |
Mar
(21) |
Apr
(9) |
May
(6) |
Jun
(11) |
Jul
(23) |
Aug
(6) |
Sep
(5) |
Oct
(7) |
Nov
(1) |
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(16) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(3) |
2021 |
Jan
|
Feb
(5) |
Mar
|
Apr
(7) |
May
(6) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Anurag C. <anu...@gm...> - 2013-04-08 21:56:54
|
Hi Tamas, Thanks for the response. Here is the result... TAG_NBR: u'2928982' <type 'unicode'> Please let me know if this gives any more ideas. I will also try a explicit type conversion using str() to see if that makes a difference. Regards, Anurag On Mon, Apr 8, 2013 at 5:32 PM, Tamás Gulácsi <gt...@gt...>wrote: > Az I've sent to the mailing list earlier: > > PLEASE print out the type of TAG_NBR! > print 'TAG_NBR:', repr(TAG_NBR), type(TAG_NBR) > > Because with bind variables, cx_Oracle has to decide what kind of thing is > that, and how to bind it (for strings, FIXED_CHAR, VARCHAR, NVARCHAR, CLOB > are all possible candidates). > > Maybe even an explicit conversion could help, but even then the language > (NLS_...) parameters can joke you! > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR > = :TAG_NBR", {'TAG_NBR': str(TAG_NBR)}) > > And watch out for NLS_ environment variables! > > GThomas > |
From: Tamás G. <gt...@gt...> - 2013-04-08 21:33:06
|
Az I've sent to the mailing list earlier: PLEASE print out the type of TAG_NBR! print 'TAG_NBR:', repr(TAG_NBR), type(TAG_NBR) Because with bind variables, cx_Oracle has to decide what kind of thing is that, and how to bind it (for strings, FIXED_CHAR, VARCHAR, NVARCHAR, CLOB are all possible candidates). Maybe even an explicit conversion could help, but even then the language (NLS_...) parameters can joke you! T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR", {'TAG_NBR': str(TAG_NBR)}) And watch out for NLS_ environment variables! GThomas |
From: Anurag C. <anu...@gm...> - 2013-04-08 21:22:15
|
Posting this one more time to see if someone has more ideas. I am finally sticking to using the queries of this sort T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) I know that this is not the best way of writing queries but I am out of options at the moment with the implementation date nearing by. Thanks for your help and guidance. Regards, Anurag On Fri, Apr 5, 2013 at 3:00 PM, Anurag Chourasia <anu...@gm... > wrote: > Hi Ivanelson, > > I am on Windows Server 2003. My original post has all the details. > > Basically the following code "Works" on my clients machine from both > within Apache and Python Command line > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = '%s' " %(TAG_NBR)) > > > > But the following code "Does Not Work" from Within Apache but Works from > Python Command line > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > Regards, > Anurag > > > On Fri, Apr 5, 2013 at 2:55 PM, Ivanelson Nunes <iva...@gm...>wrote: > >> Check the environment variables. I set up in [1] /etc/apache2/envvars >> >> Example my file envvars: >> ## Settings My Oracle >> export ORACLE_HOME=/usr/lib/oracle/11.2/client64 >> export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib >> >> >> [1] Ubuntu >> >> >> >> 2013/4/5 Anurag Chourasia <anu...@gm...> >> >>> Dear All...I encountered another behavior today. >>> >>> This issue presents itself only when the cx_Oracle code is run inside >>> the Web App (Hosted on Apache). >>> >>> If i run the same code with named parameters from within the python >>> command line then the query runs just fine. >>> >>> Appreciate if someone could provide me some ideas. >>> >>> Regards, >>> Anurag >>> >>> >>> On Wed, Apr 3, 2013 at 10:35 PM, Anurag Chourasia < >>> anu...@gm...> wrote: >>> >>>> So the problem is only with named parameters? Or is there any other >>>> alternate recommended way? Does cx_Oracle support positional parameters? >>>> >>>> Shall I continue using the following way of writing queries then? >>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR >>>> = '%s' " %(TAG_NBR)) >>>> >>>> In any case I will give this a shot with 64 Bit version of cx_Oracle >>>> tomorrow but I am not sure of that will make any difference. >>>> >>>> Appreciate your feedback. >>>> >>>> Regards, >>>> Anurag >>>> >>>> On Wed, Apr 3, 2013 at 7:41 PM, Amaury Forgeot d'Arc < >>>> ama...@gm...> wrote: >>>> >>>>> Hi, >>>>> >>>>> This thread: >>>>> https://forums.oracle.com/forums/thread.jspa?threadID=507725 >>>>> Suggests a bug in Oracle 10.2.0.1.0... >>>>> >>>>> >>>>> 2013/4/4 Anurag Chourasia <anu...@gm...> >>>>> >>>>>> Type of TAG_NBR in Python is <type 'str'> >>>>>> TAG_HIST.TAG_NBR column is varchar2 (100) >>>>>> >>>>>> In this particular example, the value of TAG_NBR was 'ABC' >>>>>> >>>>>> Regards, >>>>>> Anurag >>>>>> >>>>>> >>>>>> On Wed, Apr 3, 2013 at 6:48 PM, Amaury Forgeot d'Arc < >>>>>> ama...@gm...> wrote: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> 2013/4/3 Anurag Chourasia <anu...@gm...> >>>>>>> >>>>>>>> Hi Joel, >>>>>>>> >>>>>>>> Yes. It is a 64 Bit Server using 32 Bit version of >>>>>>>> cx_Oracle.....Could that be a problem? Given that on the same server >>>>>>>> >>>>>>>> This 'Works Fine' >>>>>>>> >>>>>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>>>>>>> >>>>>>>> ......but this 'Does Not' >>>>>>>> >>>>>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>>>> >>>>>>>> >>>>>>> What is the type of the TAG_NBR variable in Python? >>>>>>> And what is the type of the TAG_HIST.TAG_NBR column? >>>>>>> >>>>>>> >>>>>>>> Regards, >>>>>>>> Anurag >>>>>>>> >>>>>>>> On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...>wrote: >>>>>>>> >>>>>>>>> 64-bit server but using 32-bit cx_oracle? >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> *From:* Anurag Chourasia [mailto:anu...@gm...] >>>>>>>>> *Sent:* Wednesday, April 03, 2013 4:46 PM >>>>>>>>> *To:* cx-...@li...; re...@gm... >>>>>>>>> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: >>>>>>>>> unimplemented or unreasonable conversion requested >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> I have encountered a problem after implementing these changes >>>>>>>>> (named parameters in RAW SQL Queries as per Python DB-API) and I am without >>>>>>>>> any clue at the moment. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> These changes worked just fine on my Development Server >>>>>>>>> >>>>>>>>> - Windows XP >>>>>>>>> - Oracle XE SQL*Plus: Release 11.2.0.2.0 >>>>>>>>> - cx_Oracle-5.1.2-11g.win32-py2.7 >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> However, when deployed on my Client's Test Server, execution of >>>>>>>>> all queries fail with this error. >>>>>>>>> >>>>>>>>> - Windows Server 2003 >>>>>>>>> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - >>>>>>>>> 64bi >>>>>>>>> - cx_Oracle-5.1.2-10g.win32-py2.7 >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Traceback (most recent call last): >>>>>>>>> >>>>>>>>> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in >>>>>>>>> regularize_TAG >>>>>>>>> >>>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>>>> WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>>>>> >>>>>>>>> DatabaseError: ORA-01460: unimplemented or unreasonable conversion >>>>>>>>> requested >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Basically the following code "Works" on my clients machine >>>>>>>>> >>>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>>>> WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> But the following code "Does Not Work" >>>>>>>>> >>>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>>>> WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Appreciate if someone could help me through this issue. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Regards, >>>>>>>>> >>>>>>>>> Anurag >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < >>>>>>>>> anu...@gm...> wrote: >>>>>>>>> >>>>>>>>> Thanks Jani...With that my issue is solved. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Regards >>>>>>>>> >>>>>>>>> Guddu >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >>>>>>>>> > *Dear friends...Could you please help me with this issue?* >>>>>>>>> > >>>>>>>>> > *Steps to reproduce?* >>>>>>>>> > 1. Fetch the value of a varchar2 column that has Null as its >>>>>>>>> current value. >>>>>>>>> > 2. Use the fetched value to update any table's column. >>>>>>>>> > >>>>>>>>> > *Expected output?* >>>>>>>>> > Instead of updating to Null, the table column gets updated to a >>>>>>>>> string value of 'None' >>>>>>>>> > >>>>>>>>> > *Version in use* >>>>>>>>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >>>>>>>>> (Intel)] on win32 >>>>>>>>> > cx_Oracle - 5.1.2 >>>>>>>>> > Oracle 11G >>>>>>>>> > >>>>>>>>> > *Additional information* >>>>>>>>> > >>>>>>>>> > This could be because in the update query, I am using '%s' >>>>>>>>> format....for example >>>>>>>>> > >>>>>>>>> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >>>>>>>>> > >>>>>>>>> > But there is no other way. If i simply use >>>>>>>>> > >>>>>>>>> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a >>>>>>>>> syntax error. >>>>>>>>> > >>>>>>>>> > There should be a way to update a column to NULL >>>>>>>>> >>>>>>>>> Why are you trying to inject data instead of using standard Python >>>>>>>>> API >>>>>>>>> to do things right? >>>>>>>>> >>>>>>>>> If you persists constructing query string completely by hand (like >>>>>>>>> you >>>>>>>>> have done), then you have to take care of NULL by yourself. >>>>>>>>> >>>>>>>>> In most cases following works better: >>>>>>>>> >>>>>>>>> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >>>>>>>>> >>>>>>>>> When you do it that way Python DB-API takes care of correct >>>>>>>>> quotation >>>>>>>>> and makes sure that there is no way to inject malicious data and >>>>>>>>> in most >>>>>>>>> cases correct datatype conversion takes a place (there is few >>>>>>>>> occassions >>>>>>>>> when this fails) >>>>>>>>> >>>>>>>>> cx_Oracle doesn't support %s format, it supports only :name (named) >>>>>>>>> format [1]. >>>>>>>>> >>>>>>>>> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >>>>>>>>> -- >>>>>>>>> Jani Tiainen >>>>>>>>> >>>>>>>>> - Well planned is half done and a half done has been sufficient >>>>>>>>> before... >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >>>>>>>>> Rise to greatness in Intel's independent game demo contest. Compete >>>>>>>>> for recognition, cash, and the chance to get your game on Steam. >>>>>>>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo >>>>>>>>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >>>>>>>>> _______________________________________________ >>>>>>>>> cx-oracle-users mailing list >>>>>>>>> cx-...@li... >>>>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------ >>>>>>>>> Confidentiality Note: This electronic message transmission is >>>>>>>>> intended only for the person or entity to which it is addressed and may >>>>>>>>> contain information that is privileged, confidential or otherwise protected >>>>>>>>> from disclosure. If you have received this transmission, but are not the >>>>>>>>> intended recipient, you are hereby notified that any disclosure, copying, >>>>>>>>> distribution or use of the contents of this information is strictly >>>>>>>>> prohibited. If you have received this e-mail in error, please contact >>>>>>>>> Continuum Performance Systems at {203.245.5000} and delete and >>>>>>>>> destroy the original message and all copies. >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------------ >>>>>>>>> Minimize network downtime and maximize team effectiveness. >>>>>>>>> Reduce network management and security costs.Learn how to hire >>>>>>>>> the most talented Cisco Certified professionals. Visit the >>>>>>>>> Employer Resources Portal >>>>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> cx-oracle-users mailing list >>>>>>>>> cx-...@li... >>>>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------------ >>>>>>>> Minimize network downtime and maximize team effectiveness. >>>>>>>> Reduce network management and security costs.Learn how to hire >>>>>>>> the most talented Cisco Certified professionals. Visit the >>>>>>>> Employer Resources Portal >>>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>>>> _______________________________________________ >>>>>>>> cx-oracle-users mailing list >>>>>>>> cx-...@li... >>>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Amaury Forgeot d'Arc >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> Minimize network downtime and maximize team effectiveness. >>>>>>> Reduce network management and security costs.Learn how to hire >>>>>>> the most talented Cisco Certified professionals. Visit the >>>>>>> Employer Resources Portal >>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>>> _______________________________________________ >>>>>>> cx-oracle-users mailing list >>>>>>> cx-...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>> >>>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Amaury Forgeot d'Arc >>>>> >>>> >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Minimize network downtime and maximize team effectiveness. >>> Reduce network management and security costs.Learn how to hire >>> the most talented Cisco Certified professionals. Visit the >>> Employer Resources Portal >>> http://www.cisco.com/web/learning/employer_resources/index.html >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Minimize network downtime and maximize team effectiveness. >> Reduce network management and security costs.Learn how to hire >> the most talented Cisco Certified professionals. Visit the >> Employer Resources Portal >> http://www.cisco.com/web/learning/employer_resources/index.html >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > |
From: Tamás G. <gt...@gt...> - 2013-04-05 19:42:22
|
PLEASE print out the type of TAG_NBR! print 'TAG_NBR:', repr(TAG_NBR), type(TAG_NBR) And watch out for NLS_ environment variables! |
From: Tamás G. <gt...@gt...> - 2013-04-05 19:33:09
|
PLEASE print out the type of TAG_NBR! print 'TAG_NBR:', repr(TAG_NBR), type(TAG_NBR) And watch out for NLS_ environment variables! 2013/4/5 <cx-...@li...> > Send cx-oracle-users mailing list submissions to > cx-...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > or, via email, send a message with subject or body 'help' to > cx-...@li... > > You can reach the person managing the list at > cx-...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of cx-oracle-users digest..." > > > Today's Topics: > > 1. Re: Named Parameters Issue - ORA-01460: unimplemented or > unreasonable conversion requested (Anurag Chourasia) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 5 Apr 2013 15:00:39 -0400 > From: Anurag Chourasia <anu...@gm...> > Subject: Re: [cx-oracle-users] Named Parameters Issue - ORA-01460: > unimplemented or unreasonable conversion requested > To: cx-...@li..., iva...@gm... > Message-ID: > <CANFgmFBj7Z=KBzmKJoi_0A1v5= > Da-...@ma...> > Content-Type: text/plain; charset="iso-8859-1" > > Hi Ivanelson, > > I am on Windows Server 2003. My original post has all the details. > > Basically the following code "Works" on my clients machine from both within > Apache and Python Command line > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = '%s' " %(TAG_NBR)) > > > > But the following code "Does Not Work" from Within Apache but Works from > Python Command line > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > Regards, > Anurag > > On Fri, Apr 5, 2013 at 2:55 PM, Ivanelson Nunes <iva...@gm... > >wrote: > > > Check the environment variables. I set up in [1] /etc/apache2/envvars > > > > Example my file envvars: > > ## Settings My Oracle > > export ORACLE_HOME=/usr/lib/oracle/11.2/client64 > > export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib > > > > > > [1] Ubuntu > > > > > > > > 2013/4/5 Anurag Chourasia <anu...@gm...> > > > >> Dear All...I encountered another behavior today. > >> > >> This issue presents itself only when the cx_Oracle code is run inside > the > >> Web App (Hosted on Apache). > >> > >> If i run the same code with named parameters from within the python > >> command line then the query runs just fine. > >> > >> Appreciate if someone could provide me some ideas. > >> > >> Regards, > >> Anurag > >> > >> > >> On Wed, Apr 3, 2013 at 10:35 PM, Anurag Chourasia < > >> anu...@gm...> wrote: > >> > >>> So the problem is only with named parameters? Or is there any other > >>> alternate recommended way? Does cx_Oracle support positional > parameters? > >>> > >>> Shall I continue using the following way of writing queries then? > >>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR > >>> = '%s' " %(TAG_NBR)) > >>> > >>> In any case I will give this a shot with 64 Bit version of cx_Oracle > >>> tomorrow but I am not sure of that will make any difference. > >>> > >>> Appreciate your feedback. > >>> > >>> Regards, > >>> Anurag > >>> > >>> On Wed, Apr 3, 2013 at 7:41 PM, Amaury Forgeot d'Arc < > ama...@gm... > >>> > wrote: > >>> > >>>> Hi, > >>>> > >>>> This thread: > >>>> https://forums.oracle.com/forums/thread.jspa?threadID=507725 > >>>> Suggests a bug in Oracle 10.2.0.1.0... > >>>> > >>>> > >>>> 2013/4/4 Anurag Chourasia <anu...@gm...> > >>>> > >>>>> Type of TAG_NBR in Python is <type 'str'> > >>>>> TAG_HIST.TAG_NBR column is varchar2 (100) > >>>>> > >>>>> In this particular example, the value of TAG_NBR was 'ABC' > >>>>> > >>>>> Regards, > >>>>> Anurag > >>>>> > >>>>> > >>>>> On Wed, Apr 3, 2013 at 6:48 PM, Amaury Forgeot d'Arc < > >>>>> ama...@gm...> wrote: > >>>>> > >>>>>> Hi, > >>>>>> > >>>>>> 2013/4/3 Anurag Chourasia <anu...@gm...> > >>>>>> > >>>>>>> Hi Joel, > >>>>>>> > >>>>>>> Yes. It is a 64 Bit Server using 32 Bit version of > >>>>>>> cx_Oracle.....Could that be a problem? Given that on the same > server > >>>>>>> > >>>>>>> This 'Works Fine' > >>>>>>> > >>>>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = '%s' " %(TAG_NBR)) > >>>>>>> > >>>>>>> ......but this 'Does Not' > >>>>>>> > >>>>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > >>>>>>> > >>>>>>> > >>>>>> What is the type of the TAG_NBR variable in Python? > >>>>>> And what is the type of the TAG_HIST.TAG_NBR column? > >>>>>> > >>>>>> > >>>>>>> Regards, > >>>>>>> Anurag > >>>>>>> > >>>>>>> On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp... > >wrote: > >>>>>>> > >>>>>>>> 64-bit server but using 32-bit cx_oracle? > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> *From:* Anurag Chourasia [mailto:anu...@gm...] > >>>>>>>> *Sent:* Wednesday, April 03, 2013 4:46 PM > >>>>>>>> *To:* cx-...@li...; re...@gm... > >>>>>>>> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: > >>>>>>>> unimplemented or unreasonable conversion requested > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> I have encountered a problem after implementing these changes > >>>>>>>> (named parameters in RAW SQL Queries as per Python DB-API) and I > am without > >>>>>>>> any clue at the moment. > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> These changes worked just fine on my Development Server > >>>>>>>> > >>>>>>>> - Windows XP > >>>>>>>> - Oracle XE SQL*Plus: Release 11.2.0.2.0 > >>>>>>>> - cx_Oracle-5.1.2-11g.win32-py2.7 > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> However, when deployed on my Client's Test Server, execution of > all > >>>>>>>> queries fail with this error. > >>>>>>>> > >>>>>>>> - Windows Server 2003 > >>>>>>>> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - > >>>>>>>> 64bi > >>>>>>>> - cx_Oracle-5.1.2-10g.win32-py2.7 > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> Traceback (most recent call last): > >>>>>>>> > >>>>>>>> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in > >>>>>>>> regularize_TAG > >>>>>>>> > >>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST > >>>>>>>> WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > >>>>>>>> > >>>>>>>> DatabaseError: ORA-01460: unimplemented or unreasonable conversion > >>>>>>>> requested > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> Basically the following code "Works" on my clients machine > >>>>>>>> > >>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST > >>>>>>>> WHERE TAG_NBR = '%s' " %(TAG_NBR)) > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> But the following code "Does Not Work" > >>>>>>>> > >>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST > >>>>>>>> WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> Appreciate if someone could help me through this issue. > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> Regards, > >>>>>>>> > >>>>>>>> Anurag > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < > >>>>>>>> anu...@gm...> wrote: > >>>>>>>> > >>>>>>>> Thanks Jani...With that my issue is solved. > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> Regards > >>>>>>>> > >>>>>>>> Guddu > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> > >>>>>>>> wrote: > >>>>>>>> > >>>>>>>> 2.4.2013 5:51, Anurag Chourasia kirjoitti: > >>>>>>>> > *Dear friends...Could you please help me with this issue?* > >>>>>>>> > > >>>>>>>> > *Steps to reproduce?* > >>>>>>>> > 1. Fetch the value of a varchar2 column that has Null as its > >>>>>>>> current value. > >>>>>>>> > 2. Use the fetched value to update any table's column. > >>>>>>>> > > >>>>>>>> > *Expected output?* > >>>>>>>> > Instead of updating to Null, the table column gets updated to a > >>>>>>>> string value of 'None' > >>>>>>>> > > >>>>>>>> > *Version in use* > >>>>>>>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit > >>>>>>>> (Intel)] on win32 > >>>>>>>> > cx_Oracle - 5.1.2 > >>>>>>>> > Oracle 11G > >>>>>>>> > > >>>>>>>> > *Additional information* > >>>>>>>> > > >>>>>>>> > This could be because in the update query, I am using '%s' > >>>>>>>> format....for example > >>>>>>>> > > >>>>>>>> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > >>>>>>>> > > >>>>>>>> > But there is no other way. If i simply use > >>>>>>>> > > >>>>>>>> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a > >>>>>>>> syntax error. > >>>>>>>> > > >>>>>>>> > There should be a way to update a column to NULL > >>>>>>>> > >>>>>>>> Why are you trying to inject data instead of using standard Python > >>>>>>>> API > >>>>>>>> to do things right? > >>>>>>>> > >>>>>>>> If you persists constructing query string completely by hand (like > >>>>>>>> you > >>>>>>>> have done), then you have to take care of NULL by yourself. > >>>>>>>> > >>>>>>>> In most cases following works better: > >>>>>>>> > >>>>>>>> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) > >>>>>>>> > >>>>>>>> When you do it that way Python DB-API takes care of correct > >>>>>>>> quotation > >>>>>>>> and makes sure that there is no way to inject malicious data and > in > >>>>>>>> most > >>>>>>>> cases correct datatype conversion takes a place (there is few > >>>>>>>> occassions > >>>>>>>> when this fails) > >>>>>>>> > >>>>>>>> cx_Oracle doesn't support %s format, it supports only :name > (named) > >>>>>>>> format [1]. > >>>>>>>> > >>>>>>>> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle > >>>>>>>> -- > >>>>>>>> Jani Tiainen > >>>>>>>> > >>>>>>>> - Well planned is half done and a half done has been sufficient > >>>>>>>> before... > >>>>>>>> > >>>>>>>> > >>>>>>>> > ------------------------------------------------------------------------------ > >>>>>>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013 > >>>>>>>> Rise to greatness in Intel's independent game demo contest. > Compete > >>>>>>>> for recognition, cash, and the chance to get your game on Steam. > >>>>>>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo > >>>>>>>> by 6/6/13. > http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > >>>>>>>> _______________________________________________ > >>>>>>>> cx-oracle-users mailing list > >>>>>>>> cx-...@li... > >>>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> ------------------------------ > >>>>>>>> Confidentiality Note: This electronic message transmission is > >>>>>>>> intended only for the person or entity to which it is addressed > and may > >>>>>>>> contain information that is privileged, confidential or otherwise > protected > >>>>>>>> from disclosure. If you have received this transmission, but are > not the > >>>>>>>> intended recipient, you are hereby notified that any disclosure, > copying, > >>>>>>>> distribution or use of the contents of this information is > strictly > >>>>>>>> prohibited. If you have received this e-mail in error, please > contact > >>>>>>>> Continuum Performance Systems at {203.245.5000} and delete and > >>>>>>>> destroy the original message and all copies. > >>>>>>>> > >>>>>>>> > >>>>>>>> > ------------------------------------------------------------------------------ > >>>>>>>> Minimize network downtime and maximize team effectiveness. > >>>>>>>> Reduce network management and security costs.Learn how to hire > >>>>>>>> the most talented Cisco Certified professionals. Visit the > >>>>>>>> Employer Resources Portal > >>>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html > >>>>>>>> > >>>>>>>> _______________________________________________ > >>>>>>>> cx-oracle-users mailing list > >>>>>>>> cx-...@li... > >>>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >>>>>>>> > >>>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > ------------------------------------------------------------------------------ > >>>>>>> Minimize network downtime and maximize team effectiveness. > >>>>>>> Reduce network management and security costs.Learn how to hire > >>>>>>> the most talented Cisco Certified professionals. Visit the > >>>>>>> Employer Resources Portal > >>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html > >>>>>>> _______________________________________________ > >>>>>>> cx-oracle-users mailing list > >>>>>>> cx-...@li... > >>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >>>>>>> > >>>>>>> > >>>>>> > >>>>>> > >>>>>> -- > >>>>>> Amaury Forgeot d'Arc > >>>>>> > >>>>>> > >>>>>> > ------------------------------------------------------------------------------ > >>>>>> Minimize network downtime and maximize team effectiveness. > >>>>>> Reduce network management and security costs.Learn how to hire > >>>>>> the most talented Cisco Certified professionals. Visit the > >>>>>> Employer Resources Portal > >>>>>> http://www.cisco.com/web/learning/employer_resources/index.html > >>>>>> _______________________________________________ > >>>>>> cx-oracle-users mailing list > >>>>>> cx-...@li... > >>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >>>>>> > >>>>>> > >>>>> > >>>> > >>>> > >>>> -- > >>>> Amaury Forgeot d'Arc > >>>> > >>> > >>> > >> > >> > >> > ------------------------------------------------------------------------------ > >> Minimize network downtime and maximize team effectiveness. > >> Reduce network management and security costs.Learn how to hire > >> the most talented Cisco Certified professionals. Visit the > >> Employer Resources Portal > >> http://www.cisco.com/web/learning/employer_resources/index.html > >> _______________________________________________ > >> cx-oracle-users mailing list > >> cx-...@li... > >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > >> > >> > > > > > > > ------------------------------------------------------------------------------ > > Minimize network downtime and maximize team effectiveness. > > Reduce network management and security costs.Learn how to hire > > the most talented Cisco Certified professionals. Visit the > > Employer Resources Portal > > http://www.cisco.com/web/learning/employer_resources/index.html > > _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > > ------------------------------ > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > End of cx-oracle-users Digest, Vol 81, Issue 9 > ********************************************** > |
From: Anurag C. <anu...@gm...> - 2013-04-05 19:01:08
|
Hi Ivanelson, I am on Windows Server 2003. My original post has all the details. Basically the following code "Works" on my clients machine from both within Apache and Python Command line T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) But the following code "Does Not Work" from Within Apache but Works from Python Command line T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) Regards, Anurag On Fri, Apr 5, 2013 at 2:55 PM, Ivanelson Nunes <iva...@gm...>wrote: > Check the environment variables. I set up in [1] /etc/apache2/envvars > > Example my file envvars: > ## Settings My Oracle > export ORACLE_HOME=/usr/lib/oracle/11.2/client64 > export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib > > > [1] Ubuntu > > > > 2013/4/5 Anurag Chourasia <anu...@gm...> > >> Dear All...I encountered another behavior today. >> >> This issue presents itself only when the cx_Oracle code is run inside the >> Web App (Hosted on Apache). >> >> If i run the same code with named parameters from within the python >> command line then the query runs just fine. >> >> Appreciate if someone could provide me some ideas. >> >> Regards, >> Anurag >> >> >> On Wed, Apr 3, 2013 at 10:35 PM, Anurag Chourasia < >> anu...@gm...> wrote: >> >>> So the problem is only with named parameters? Or is there any other >>> alternate recommended way? Does cx_Oracle support positional parameters? >>> >>> Shall I continue using the following way of writing queries then? >>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR >>> = '%s' " %(TAG_NBR)) >>> >>> In any case I will give this a shot with 64 Bit version of cx_Oracle >>> tomorrow but I am not sure of that will make any difference. >>> >>> Appreciate your feedback. >>> >>> Regards, >>> Anurag >>> >>> On Wed, Apr 3, 2013 at 7:41 PM, Amaury Forgeot d'Arc <ama...@gm... >>> > wrote: >>> >>>> Hi, >>>> >>>> This thread: >>>> https://forums.oracle.com/forums/thread.jspa?threadID=507725 >>>> Suggests a bug in Oracle 10.2.0.1.0... >>>> >>>> >>>> 2013/4/4 Anurag Chourasia <anu...@gm...> >>>> >>>>> Type of TAG_NBR in Python is <type 'str'> >>>>> TAG_HIST.TAG_NBR column is varchar2 (100) >>>>> >>>>> In this particular example, the value of TAG_NBR was 'ABC' >>>>> >>>>> Regards, >>>>> Anurag >>>>> >>>>> >>>>> On Wed, Apr 3, 2013 at 6:48 PM, Amaury Forgeot d'Arc < >>>>> ama...@gm...> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> 2013/4/3 Anurag Chourasia <anu...@gm...> >>>>>> >>>>>>> Hi Joel, >>>>>>> >>>>>>> Yes. It is a 64 Bit Server using 32 Bit version of >>>>>>> cx_Oracle.....Could that be a problem? Given that on the same server >>>>>>> >>>>>>> This 'Works Fine' >>>>>>> >>>>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>>>>>> >>>>>>> ......but this 'Does Not' >>>>>>> >>>>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>>> >>>>>>> >>>>>> What is the type of the TAG_NBR variable in Python? >>>>>> And what is the type of the TAG_HIST.TAG_NBR column? >>>>>> >>>>>> >>>>>>> Regards, >>>>>>> Anurag >>>>>>> >>>>>>> On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...>wrote: >>>>>>> >>>>>>>> 64-bit server but using 32-bit cx_oracle? >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> *From:* Anurag Chourasia [mailto:anu...@gm...] >>>>>>>> *Sent:* Wednesday, April 03, 2013 4:46 PM >>>>>>>> *To:* cx-...@li...; re...@gm... >>>>>>>> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: >>>>>>>> unimplemented or unreasonable conversion requested >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> I have encountered a problem after implementing these changes >>>>>>>> (named parameters in RAW SQL Queries as per Python DB-API) and I am without >>>>>>>> any clue at the moment. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> These changes worked just fine on my Development Server >>>>>>>> >>>>>>>> - Windows XP >>>>>>>> - Oracle XE SQL*Plus: Release 11.2.0.2.0 >>>>>>>> - cx_Oracle-5.1.2-11g.win32-py2.7 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> However, when deployed on my Client's Test Server, execution of all >>>>>>>> queries fail with this error. >>>>>>>> >>>>>>>> - Windows Server 2003 >>>>>>>> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - >>>>>>>> 64bi >>>>>>>> - cx_Oracle-5.1.2-10g.win32-py2.7 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Traceback (most recent call last): >>>>>>>> >>>>>>>> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in >>>>>>>> regularize_TAG >>>>>>>> >>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>>> WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>>>> >>>>>>>> DatabaseError: ORA-01460: unimplemented or unreasonable conversion >>>>>>>> requested >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Basically the following code "Works" on my clients machine >>>>>>>> >>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>>> WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> But the following code "Does Not Work" >>>>>>>> >>>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>>> WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Appreciate if someone could help me through this issue. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Regards, >>>>>>>> >>>>>>>> Anurag >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < >>>>>>>> anu...@gm...> wrote: >>>>>>>> >>>>>>>> Thanks Jani...With that my issue is solved. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Regards >>>>>>>> >>>>>>>> Guddu >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> >>>>>>>> wrote: >>>>>>>> >>>>>>>> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >>>>>>>> > *Dear friends...Could you please help me with this issue?* >>>>>>>> > >>>>>>>> > *Steps to reproduce?* >>>>>>>> > 1. Fetch the value of a varchar2 column that has Null as its >>>>>>>> current value. >>>>>>>> > 2. Use the fetched value to update any table's column. >>>>>>>> > >>>>>>>> > *Expected output?* >>>>>>>> > Instead of updating to Null, the table column gets updated to a >>>>>>>> string value of 'None' >>>>>>>> > >>>>>>>> > *Version in use* >>>>>>>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >>>>>>>> (Intel)] on win32 >>>>>>>> > cx_Oracle - 5.1.2 >>>>>>>> > Oracle 11G >>>>>>>> > >>>>>>>> > *Additional information* >>>>>>>> > >>>>>>>> > This could be because in the update query, I am using '%s' >>>>>>>> format....for example >>>>>>>> > >>>>>>>> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >>>>>>>> > >>>>>>>> > But there is no other way. If i simply use >>>>>>>> > >>>>>>>> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a >>>>>>>> syntax error. >>>>>>>> > >>>>>>>> > There should be a way to update a column to NULL >>>>>>>> >>>>>>>> Why are you trying to inject data instead of using standard Python >>>>>>>> API >>>>>>>> to do things right? >>>>>>>> >>>>>>>> If you persists constructing query string completely by hand (like >>>>>>>> you >>>>>>>> have done), then you have to take care of NULL by yourself. >>>>>>>> >>>>>>>> In most cases following works better: >>>>>>>> >>>>>>>> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >>>>>>>> >>>>>>>> When you do it that way Python DB-API takes care of correct >>>>>>>> quotation >>>>>>>> and makes sure that there is no way to inject malicious data and in >>>>>>>> most >>>>>>>> cases correct datatype conversion takes a place (there is few >>>>>>>> occassions >>>>>>>> when this fails) >>>>>>>> >>>>>>>> cx_Oracle doesn't support %s format, it supports only :name (named) >>>>>>>> format [1]. >>>>>>>> >>>>>>>> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >>>>>>>> -- >>>>>>>> Jani Tiainen >>>>>>>> >>>>>>>> - Well planned is half done and a half done has been sufficient >>>>>>>> before... >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------------ >>>>>>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >>>>>>>> Rise to greatness in Intel's independent game demo contest. Compete >>>>>>>> for recognition, cash, and the chance to get your game on Steam. >>>>>>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo >>>>>>>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >>>>>>>> _______________________________________________ >>>>>>>> cx-oracle-users mailing list >>>>>>>> cx-...@li... >>>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------ >>>>>>>> Confidentiality Note: This electronic message transmission is >>>>>>>> intended only for the person or entity to which it is addressed and may >>>>>>>> contain information that is privileged, confidential or otherwise protected >>>>>>>> from disclosure. If you have received this transmission, but are not the >>>>>>>> intended recipient, you are hereby notified that any disclosure, copying, >>>>>>>> distribution or use of the contents of this information is strictly >>>>>>>> prohibited. If you have received this e-mail in error, please contact >>>>>>>> Continuum Performance Systems at {203.245.5000} and delete and >>>>>>>> destroy the original message and all copies. >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------------ >>>>>>>> Minimize network downtime and maximize team effectiveness. >>>>>>>> Reduce network management and security costs.Learn how to hire >>>>>>>> the most talented Cisco Certified professionals. Visit the >>>>>>>> Employer Resources Portal >>>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> cx-oracle-users mailing list >>>>>>>> cx-...@li... >>>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> Minimize network downtime and maximize team effectiveness. >>>>>>> Reduce network management and security costs.Learn how to hire >>>>>>> the most talented Cisco Certified professionals. Visit the >>>>>>> Employer Resources Portal >>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>>> _______________________________________________ >>>>>>> cx-oracle-users mailing list >>>>>>> cx-...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Amaury Forgeot d'Arc >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Minimize network downtime and maximize team effectiveness. >>>>>> Reduce network management and security costs.Learn how to hire >>>>>> the most talented Cisco Certified professionals. Visit the >>>>>> Employer Resources Portal >>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>> _______________________________________________ >>>>>> cx-oracle-users mailing list >>>>>> cx-...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> Amaury Forgeot d'Arc >>>> >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Minimize network downtime and maximize team effectiveness. >> Reduce network management and security costs.Learn how to hire >> the most talented Cisco Certified professionals. Visit the >> Employer Resources Portal >> http://www.cisco.com/web/learning/employer_resources/index.html >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Ivanelson N. <iva...@gm...> - 2013-04-05 18:56:07
|
Check the environment variables. I set up in [1] /etc/apache2/envvars Example my file envvars: ## Settings My Oracle export ORACLE_HOME=/usr/lib/oracle/11.2/client64 export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib [1] Ubuntu 2013/4/5 Anurag Chourasia <anu...@gm...> > Dear All...I encountered another behavior today. > > This issue presents itself only when the cx_Oracle code is run inside the > Web App (Hosted on Apache). > > If i run the same code with named parameters from within the python > command line then the query runs just fine. > > Appreciate if someone could provide me some ideas. > > Regards, > Anurag > > > On Wed, Apr 3, 2013 at 10:35 PM, Anurag Chourasia < > anu...@gm...> wrote: > >> So the problem is only with named parameters? Or is there any other >> alternate recommended way? Does cx_Oracle support positional parameters? >> >> Shall I continue using the following way of writing queries then? >> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = >> '%s' " %(TAG_NBR)) >> >> In any case I will give this a shot with 64 Bit version of cx_Oracle >> tomorrow but I am not sure of that will make any difference. >> >> Appreciate your feedback. >> >> Regards, >> Anurag >> >> On Wed, Apr 3, 2013 at 7:41 PM, Amaury Forgeot d'Arc <ama...@gm...>wrote: >> >>> Hi, >>> >>> This thread: >>> https://forums.oracle.com/forums/thread.jspa?threadID=507725 >>> Suggests a bug in Oracle 10.2.0.1.0... >>> >>> >>> 2013/4/4 Anurag Chourasia <anu...@gm...> >>> >>>> Type of TAG_NBR in Python is <type 'str'> >>>> TAG_HIST.TAG_NBR column is varchar2 (100) >>>> >>>> In this particular example, the value of TAG_NBR was 'ABC' >>>> >>>> Regards, >>>> Anurag >>>> >>>> >>>> On Wed, Apr 3, 2013 at 6:48 PM, Amaury Forgeot d'Arc < >>>> ama...@gm...> wrote: >>>> >>>>> Hi, >>>>> >>>>> 2013/4/3 Anurag Chourasia <anu...@gm...> >>>>> >>>>>> Hi Joel, >>>>>> >>>>>> Yes. It is a 64 Bit Server using 32 Bit version of >>>>>> cx_Oracle.....Could that be a problem? Given that on the same server >>>>>> >>>>>> This 'Works Fine' >>>>>> >>>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>>>>> >>>>>> ......but this 'Does Not' >>>>>> >>>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>> >>>>>> >>>>> What is the type of the TAG_NBR variable in Python? >>>>> And what is the type of the TAG_HIST.TAG_NBR column? >>>>> >>>>> >>>>>> Regards, >>>>>> Anurag >>>>>> >>>>>> On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...>wrote: >>>>>> >>>>>>> 64-bit server but using 32-bit cx_oracle? >>>>>>> >>>>>>> >>>>>>> >>>>>>> *From:* Anurag Chourasia [mailto:anu...@gm...] >>>>>>> *Sent:* Wednesday, April 03, 2013 4:46 PM >>>>>>> *To:* cx-...@li...; re...@gm... >>>>>>> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: >>>>>>> unimplemented or unreasonable conversion requested >>>>>>> >>>>>>> >>>>>>> >>>>>>> I have encountered a problem after implementing these changes (named >>>>>>> parameters in RAW SQL Queries as per Python DB-API) and I am without any >>>>>>> clue at the moment. >>>>>>> >>>>>>> >>>>>>> >>>>>>> These changes worked just fine on my Development Server >>>>>>> >>>>>>> - Windows XP >>>>>>> - Oracle XE SQL*Plus: Release 11.2.0.2.0 >>>>>>> - cx_Oracle-5.1.2-11g.win32-py2.7 >>>>>>> >>>>>>> >>>>>>> >>>>>>> However, when deployed on my Client's Test Server, execution of all >>>>>>> queries fail with this error. >>>>>>> >>>>>>> - Windows Server 2003 >>>>>>> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - >>>>>>> 64bi >>>>>>> - cx_Oracle-5.1.2-10g.win32-py2.7 >>>>>>> >>>>>>> >>>>>>> >>>>>>> Traceback (most recent call last): >>>>>>> >>>>>>> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in >>>>>>> regularize_TAG >>>>>>> >>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>> WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>>> >>>>>>> DatabaseError: ORA-01460: unimplemented or unreasonable conversion >>>>>>> requested >>>>>>> >>>>>>> >>>>>>> >>>>>>> Basically the following code "Works" on my clients machine >>>>>>> >>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>> WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>>>>>> >>>>>>> >>>>>>> >>>>>>> But the following code "Does Not Work" >>>>>>> >>>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST >>>>>>> WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>>> >>>>>>> >>>>>>> >>>>>>> Appreciate if someone could help me through this issue. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Regards, >>>>>>> >>>>>>> Anurag >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < >>>>>>> anu...@gm...> wrote: >>>>>>> >>>>>>> Thanks Jani...With that my issue is solved. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Regards >>>>>>> >>>>>>> Guddu >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> >>>>>>> wrote: >>>>>>> >>>>>>> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >>>>>>> > *Dear friends...Could you please help me with this issue?* >>>>>>> > >>>>>>> > *Steps to reproduce?* >>>>>>> > 1. Fetch the value of a varchar2 column that has Null as its >>>>>>> current value. >>>>>>> > 2. Use the fetched value to update any table's column. >>>>>>> > >>>>>>> > *Expected output?* >>>>>>> > Instead of updating to Null, the table column gets updated to a >>>>>>> string value of 'None' >>>>>>> > >>>>>>> > *Version in use* >>>>>>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >>>>>>> (Intel)] on win32 >>>>>>> > cx_Oracle - 5.1.2 >>>>>>> > Oracle 11G >>>>>>> > >>>>>>> > *Additional information* >>>>>>> > >>>>>>> > This could be because in the update query, I am using '%s' >>>>>>> format....for example >>>>>>> > >>>>>>> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >>>>>>> > >>>>>>> > But there is no other way. If i simply use >>>>>>> > >>>>>>> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a >>>>>>> syntax error. >>>>>>> > >>>>>>> > There should be a way to update a column to NULL >>>>>>> >>>>>>> Why are you trying to inject data instead of using standard Python >>>>>>> API >>>>>>> to do things right? >>>>>>> >>>>>>> If you persists constructing query string completely by hand (like >>>>>>> you >>>>>>> have done), then you have to take care of NULL by yourself. >>>>>>> >>>>>>> In most cases following works better: >>>>>>> >>>>>>> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >>>>>>> >>>>>>> When you do it that way Python DB-API takes care of correct quotation >>>>>>> and makes sure that there is no way to inject malicious data and in >>>>>>> most >>>>>>> cases correct datatype conversion takes a place (there is few >>>>>>> occassions >>>>>>> when this fails) >>>>>>> >>>>>>> cx_Oracle doesn't support %s format, it supports only :name (named) >>>>>>> format [1]. >>>>>>> >>>>>>> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >>>>>>> -- >>>>>>> Jani Tiainen >>>>>>> >>>>>>> - Well planned is half done and a half done has been sufficient >>>>>>> before... >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >>>>>>> Rise to greatness in Intel's independent game demo contest. Compete >>>>>>> for recognition, cash, and the chance to get your game on Steam. >>>>>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo >>>>>>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >>>>>>> _______________________________________________ >>>>>>> cx-oracle-users mailing list >>>>>>> cx-...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------ >>>>>>> Confidentiality Note: This electronic message transmission is >>>>>>> intended only for the person or entity to which it is addressed and may >>>>>>> contain information that is privileged, confidential or otherwise protected >>>>>>> from disclosure. If you have received this transmission, but are not the >>>>>>> intended recipient, you are hereby notified that any disclosure, copying, >>>>>>> distribution or use of the contents of this information is strictly >>>>>>> prohibited. If you have received this e-mail in error, please contact >>>>>>> Continuum Performance Systems at {203.245.5000} and delete and >>>>>>> destroy the original message and all copies. >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> Minimize network downtime and maximize team effectiveness. >>>>>>> Reduce network management and security costs.Learn how to hire >>>>>>> the most talented Cisco Certified professionals. Visit the >>>>>>> Employer Resources Portal >>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>>> >>>>>>> _______________________________________________ >>>>>>> cx-oracle-users mailing list >>>>>>> cx-...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Minimize network downtime and maximize team effectiveness. >>>>>> Reduce network management and security costs.Learn how to hire >>>>>> the most talented Cisco Certified professionals. Visit the >>>>>> Employer Resources Portal >>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>> _______________________________________________ >>>>>> cx-oracle-users mailing list >>>>>> cx-...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Amaury Forgeot d'Arc >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Minimize network downtime and maximize team effectiveness. >>>>> Reduce network management and security costs.Learn how to hire >>>>> the most talented Cisco Certified professionals. Visit the >>>>> Employer Resources Portal >>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>> _______________________________________________ >>>>> cx-oracle-users mailing list >>>>> cx-...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>> >>>>> >>>> >>> >>> >>> -- >>> Amaury Forgeot d'Arc >>> >> >> > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Anurag C. <anu...@gm...> - 2013-04-05 18:43:40
|
Dear All...I encountered another behavior today. This issue presents itself only when the cx_Oracle code is run inside the Web App (Hosted on Apache). If i run the same code with named parameters from within the python command line then the query runs just fine. Appreciate if someone could provide me some ideas. Regards, Anurag On Wed, Apr 3, 2013 at 10:35 PM, Anurag Chourasia < anu...@gm...> wrote: > So the problem is only with named parameters? Or is there any other > alternate recommended way? Does cx_Oracle support positional parameters? > > Shall I continue using the following way of writing queries then? > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = > '%s' " %(TAG_NBR)) > > In any case I will give this a shot with 64 Bit version of cx_Oracle > tomorrow but I am not sure of that will make any difference. > > Appreciate your feedback. > > Regards, > Anurag > > On Wed, Apr 3, 2013 at 7:41 PM, Amaury Forgeot d'Arc <ama...@gm...>wrote: > >> Hi, >> >> This thread: https://forums.oracle.com/forums/thread.jspa?threadID=507725 >> Suggests a bug in Oracle 10.2.0.1.0... >> >> >> 2013/4/4 Anurag Chourasia <anu...@gm...> >> >>> Type of TAG_NBR in Python is <type 'str'> >>> TAG_HIST.TAG_NBR column is varchar2 (100) >>> >>> In this particular example, the value of TAG_NBR was 'ABC' >>> >>> Regards, >>> Anurag >>> >>> >>> On Wed, Apr 3, 2013 at 6:48 PM, Amaury Forgeot d'Arc <ama...@gm... >>> > wrote: >>> >>>> Hi, >>>> >>>> 2013/4/3 Anurag Chourasia <anu...@gm...> >>>> >>>>> Hi Joel, >>>>> >>>>> Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could >>>>> that be a problem? Given that on the same server >>>>> >>>>> This 'Works Fine' >>>>> >>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>>>> >>>>> ......but this 'Does Not' >>>>> >>>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>> >>>>> >>>> What is the type of the TAG_NBR variable in Python? >>>> And what is the type of the TAG_HIST.TAG_NBR column? >>>> >>>> >>>>> Regards, >>>>> Anurag >>>>> >>>>> On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...> wrote: >>>>> >>>>>> 64-bit server but using 32-bit cx_oracle? >>>>>> >>>>>> >>>>>> >>>>>> *From:* Anurag Chourasia [mailto:anu...@gm...] >>>>>> *Sent:* Wednesday, April 03, 2013 4:46 PM >>>>>> *To:* cx-...@li...; re...@gm... >>>>>> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: >>>>>> unimplemented or unreasonable conversion requested >>>>>> >>>>>> >>>>>> >>>>>> I have encountered a problem after implementing these changes (named >>>>>> parameters in RAW SQL Queries as per Python DB-API) and I am without any >>>>>> clue at the moment. >>>>>> >>>>>> >>>>>> >>>>>> These changes worked just fine on my Development Server >>>>>> >>>>>> - Windows XP >>>>>> - Oracle XE SQL*Plus: Release 11.2.0.2.0 >>>>>> - cx_Oracle-5.1.2-11g.win32-py2.7 >>>>>> >>>>>> >>>>>> >>>>>> However, when deployed on my Client's Test Server, execution of all >>>>>> queries fail with this error. >>>>>> >>>>>> - Windows Server 2003 >>>>>> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi >>>>>> - cx_Oracle-5.1.2-10g.win32-py2.7 >>>>>> >>>>>> >>>>>> >>>>>> Traceback (most recent call last): >>>>>> >>>>>> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in >>>>>> regularize_TAG >>>>>> >>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>>>> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>> >>>>>> DatabaseError: ORA-01460: unimplemented or unreasonable conversion >>>>>> requested >>>>>> >>>>>> >>>>>> >>>>>> Basically the following code "Works" on my clients machine >>>>>> >>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>>>> TAG_NBR = '%s' " %(TAG_NBR)) >>>>>> >>>>>> >>>>>> >>>>>> But the following code "Does Not Work" >>>>>> >>>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>>>> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>>> >>>>>> >>>>>> >>>>>> Appreciate if someone could help me through this issue. >>>>>> >>>>>> >>>>>> >>>>>> Regards, >>>>>> >>>>>> Anurag >>>>>> >>>>>> >>>>>> >>>>>> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < >>>>>> anu...@gm...> wrote: >>>>>> >>>>>> Thanks Jani...With that my issue is solved. >>>>>> >>>>>> >>>>>> >>>>>> Regards >>>>>> >>>>>> Guddu >>>>>> >>>>>> >>>>>> >>>>>> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> >>>>>> wrote: >>>>>> >>>>>> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >>>>>> > *Dear friends...Could you please help me with this issue?* >>>>>> > >>>>>> > *Steps to reproduce?* >>>>>> > 1. Fetch the value of a varchar2 column that has Null as its >>>>>> current value. >>>>>> > 2. Use the fetched value to update any table's column. >>>>>> > >>>>>> > *Expected output?* >>>>>> > Instead of updating to Null, the table column gets updated to a >>>>>> string value of 'None' >>>>>> > >>>>>> > *Version in use* >>>>>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >>>>>> (Intel)] on win32 >>>>>> > cx_Oracle - 5.1.2 >>>>>> > Oracle 11G >>>>>> > >>>>>> > *Additional information* >>>>>> > >>>>>> > This could be because in the update query, I am using '%s' >>>>>> format....for example >>>>>> > >>>>>> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >>>>>> > >>>>>> > But there is no other way. If i simply use >>>>>> > >>>>>> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a >>>>>> syntax error. >>>>>> > >>>>>> > There should be a way to update a column to NULL >>>>>> >>>>>> Why are you trying to inject data instead of using standard Python API >>>>>> to do things right? >>>>>> >>>>>> If you persists constructing query string completely by hand (like you >>>>>> have done), then you have to take care of NULL by yourself. >>>>>> >>>>>> In most cases following works better: >>>>>> >>>>>> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >>>>>> >>>>>> When you do it that way Python DB-API takes care of correct quotation >>>>>> and makes sure that there is no way to inject malicious data and in >>>>>> most >>>>>> cases correct datatype conversion takes a place (there is few >>>>>> occassions >>>>>> when this fails) >>>>>> >>>>>> cx_Oracle doesn't support %s format, it supports only :name (named) >>>>>> format [1]. >>>>>> >>>>>> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >>>>>> -- >>>>>> Jani Tiainen >>>>>> >>>>>> - Well planned is half done and a half done has been sufficient >>>>>> before... >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >>>>>> Rise to greatness in Intel's independent game demo contest. Compete >>>>>> for recognition, cash, and the chance to get your game on Steam. >>>>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo >>>>>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >>>>>> _______________________________________________ >>>>>> cx-oracle-users mailing list >>>>>> cx-...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------ >>>>>> Confidentiality Note: This electronic message transmission is >>>>>> intended only for the person or entity to which it is addressed and may >>>>>> contain information that is privileged, confidential or otherwise protected >>>>>> from disclosure. If you have received this transmission, but are not the >>>>>> intended recipient, you are hereby notified that any disclosure, copying, >>>>>> distribution or use of the contents of this information is strictly >>>>>> prohibited. If you have received this e-mail in error, please contact >>>>>> Continuum Performance Systems at {203.245.5000} and delete and >>>>>> destroy the original message and all copies. >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Minimize network downtime and maximize team effectiveness. >>>>>> Reduce network management and security costs.Learn how to hire >>>>>> the most talented Cisco Certified professionals. Visit the >>>>>> Employer Resources Portal >>>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>>> >>>>>> _______________________________________________ >>>>>> cx-oracle-users mailing list >>>>>> cx-...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>>> >>>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Minimize network downtime and maximize team effectiveness. >>>>> Reduce network management and security costs.Learn how to hire >>>>> the most talented Cisco Certified professionals. Visit the >>>>> Employer Resources Portal >>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>> _______________________________________________ >>>>> cx-oracle-users mailing list >>>>> cx-...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>> >>>>> >>>> >>>> >>>> -- >>>> Amaury Forgeot d'Arc >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Minimize network downtime and maximize team effectiveness. >>>> Reduce network management and security costs.Learn how to hire >>>> the most talented Cisco Certified professionals. Visit the >>>> Employer Resources Portal >>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>> _______________________________________________ >>>> cx-oracle-users mailing list >>>> cx-...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>> >>>> >>> >> >> >> -- >> Amaury Forgeot d'Arc >> > > |
From: Anurag C. <anu...@gm...> - 2013-04-04 02:36:19
|
So the problem is only with named parameters? Or is there any other alternate recommended way? Does cx_Oracle support positional parameters? Shall I continue using the following way of writing queries then? cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) In any case I will give this a shot with 64 Bit version of cx_Oracle tomorrow but I am not sure of that will make any difference. Appreciate your feedback. Regards, Anurag On Wed, Apr 3, 2013 at 7:41 PM, Amaury Forgeot d'Arc <ama...@gm...>wrote: > Hi, > > This thread: https://forums.oracle.com/forums/thread.jspa?threadID=507725 > Suggests a bug in Oracle 10.2.0.1.0... > > > 2013/4/4 Anurag Chourasia <anu...@gm...> > >> Type of TAG_NBR in Python is <type 'str'> >> TAG_HIST.TAG_NBR column is varchar2 (100) >> >> In this particular example, the value of TAG_NBR was 'ABC' >> >> Regards, >> Anurag >> >> >> On Wed, Apr 3, 2013 at 6:48 PM, Amaury Forgeot d'Arc <ama...@gm...>wrote: >> >>> Hi, >>> >>> 2013/4/3 Anurag Chourasia <anu...@gm...> >>> >>>> Hi Joel, >>>> >>>> Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could >>>> that be a problem? Given that on the same server >>>> >>>> This 'Works Fine' >>>> >>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>>> >>>> ......but this 'Does Not' >>>> >>>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>> >>>> >>> What is the type of the TAG_NBR variable in Python? >>> And what is the type of the TAG_HIST.TAG_NBR column? >>> >>> >>>> Regards, >>>> Anurag >>>> >>>> On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...> wrote: >>>> >>>>> 64-bit server but using 32-bit cx_oracle? >>>>> >>>>> >>>>> >>>>> *From:* Anurag Chourasia [mailto:anu...@gm...] >>>>> *Sent:* Wednesday, April 03, 2013 4:46 PM >>>>> *To:* cx-...@li...; re...@gm... >>>>> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: >>>>> unimplemented or unreasonable conversion requested >>>>> >>>>> >>>>> >>>>> I have encountered a problem after implementing these changes (named >>>>> parameters in RAW SQL Queries as per Python DB-API) and I am without any >>>>> clue at the moment. >>>>> >>>>> >>>>> >>>>> These changes worked just fine on my Development Server >>>>> >>>>> - Windows XP >>>>> - Oracle XE SQL*Plus: Release 11.2.0.2.0 >>>>> - cx_Oracle-5.1.2-11g.win32-py2.7 >>>>> >>>>> >>>>> >>>>> However, when deployed on my Client's Test Server, execution of all >>>>> queries fail with this error. >>>>> >>>>> - Windows Server 2003 >>>>> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi >>>>> - cx_Oracle-5.1.2-10g.win32-py2.7 >>>>> >>>>> >>>>> >>>>> Traceback (most recent call last): >>>>> >>>>> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in >>>>> regularize_TAG >>>>> >>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>>> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>> >>>>> DatabaseError: ORA-01460: unimplemented or unreasonable conversion >>>>> requested >>>>> >>>>> >>>>> >>>>> Basically the following code "Works" on my clients machine >>>>> >>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>>> TAG_NBR = '%s' " %(TAG_NBR)) >>>>> >>>>> >>>>> >>>>> But the following code "Does Not Work" >>>>> >>>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>>> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>>> >>>>> >>>>> >>>>> Appreciate if someone could help me through this issue. >>>>> >>>>> >>>>> >>>>> Regards, >>>>> >>>>> Anurag >>>>> >>>>> >>>>> >>>>> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < >>>>> anu...@gm...> wrote: >>>>> >>>>> Thanks Jani...With that my issue is solved. >>>>> >>>>> >>>>> >>>>> Regards >>>>> >>>>> Guddu >>>>> >>>>> >>>>> >>>>> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> >>>>> wrote: >>>>> >>>>> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >>>>> > *Dear friends...Could you please help me with this issue?* >>>>> > >>>>> > *Steps to reproduce?* >>>>> > 1. Fetch the value of a varchar2 column that has Null as its current >>>>> value. >>>>> > 2. Use the fetched value to update any table's column. >>>>> > >>>>> > *Expected output?* >>>>> > Instead of updating to Null, the table column gets updated to a >>>>> string value of 'None' >>>>> > >>>>> > *Version in use* >>>>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >>>>> (Intel)] on win32 >>>>> > cx_Oracle - 5.1.2 >>>>> > Oracle 11G >>>>> > >>>>> > *Additional information* >>>>> > >>>>> > This could be because in the update query, I am using '%s' >>>>> format....for example >>>>> > >>>>> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >>>>> > >>>>> > But there is no other way. If i simply use >>>>> > >>>>> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax >>>>> error. >>>>> > >>>>> > There should be a way to update a column to NULL >>>>> >>>>> Why are you trying to inject data instead of using standard Python API >>>>> to do things right? >>>>> >>>>> If you persists constructing query string completely by hand (like you >>>>> have done), then you have to take care of NULL by yourself. >>>>> >>>>> In most cases following works better: >>>>> >>>>> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >>>>> >>>>> When you do it that way Python DB-API takes care of correct quotation >>>>> and makes sure that there is no way to inject malicious data and in >>>>> most >>>>> cases correct datatype conversion takes a place (there is few >>>>> occassions >>>>> when this fails) >>>>> >>>>> cx_Oracle doesn't support %s format, it supports only :name (named) >>>>> format [1]. >>>>> >>>>> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >>>>> -- >>>>> Jani Tiainen >>>>> >>>>> - Well planned is half done and a half done has been sufficient >>>>> before... >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >>>>> Rise to greatness in Intel's independent game demo contest. Compete >>>>> for recognition, cash, and the chance to get your game on Steam. >>>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo >>>>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >>>>> _______________________________________________ >>>>> cx-oracle-users mailing list >>>>> cx-...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>> >>>>> >>>>> >>>>> >>>>> ------------------------------ >>>>> Confidentiality Note: This electronic message transmission is intended >>>>> only for the person or entity to which it is addressed and may contain >>>>> information that is privileged, confidential or otherwise protected from >>>>> disclosure. If you have received this transmission, but are not the >>>>> intended recipient, you are hereby notified that any disclosure, copying, >>>>> distribution or use of the contents of this information is strictly >>>>> prohibited. If you have received this e-mail in error, please contact >>>>> Continuum Performance Systems at {203.245.5000} and delete and >>>>> destroy the original message and all copies. >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Minimize network downtime and maximize team effectiveness. >>>>> Reduce network management and security costs.Learn how to hire >>>>> the most talented Cisco Certified professionals. Visit the >>>>> Employer Resources Portal >>>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>>> >>>>> _______________________________________________ >>>>> cx-oracle-users mailing list >>>>> cx-...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>> >>>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Minimize network downtime and maximize team effectiveness. >>>> Reduce network management and security costs.Learn how to hire >>>> the most talented Cisco Certified professionals. Visit the >>>> Employer Resources Portal >>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>> _______________________________________________ >>>> cx-oracle-users mailing list >>>> cx-...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>> >>>> >>> >>> >>> -- >>> Amaury Forgeot d'Arc >>> >>> >>> ------------------------------------------------------------------------------ >>> Minimize network downtime and maximize team effectiveness. >>> Reduce network management and security costs.Learn how to hire >>> the most talented Cisco Certified professionals. Visit the >>> Employer Resources Portal >>> http://www.cisco.com/web/learning/employer_resources/index.html >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >>> >> > > > -- > Amaury Forgeot d'Arc > |
From: Amaury F. d'A. <ama...@gm...> - 2013-04-03 23:41:17
|
Hi, This thread: https://forums.oracle.com/forums/thread.jspa?threadID=507725 Suggests a bug in Oracle 10.2.0.1.0... 2013/4/4 Anurag Chourasia <anu...@gm...> > Type of TAG_NBR in Python is <type 'str'> > TAG_HIST.TAG_NBR column is varchar2 (100) > > In this particular example, the value of TAG_NBR was 'ABC' > > Regards, > Anurag > > > On Wed, Apr 3, 2013 at 6:48 PM, Amaury Forgeot d'Arc <ama...@gm...>wrote: > >> Hi, >> >> 2013/4/3 Anurag Chourasia <anu...@gm...> >> >>> Hi Joel, >>> >>> Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could >>> that be a problem? Given that on the same server >>> >>> This 'Works Fine' >>> >>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) >>> >>> ......but this 'Does Not' >>> >>> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>> >>> >> What is the type of the TAG_NBR variable in Python? >> And what is the type of the TAG_HIST.TAG_NBR column? >> >> >>> Regards, >>> Anurag >>> >>> On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...> wrote: >>> >>>> 64-bit server but using 32-bit cx_oracle? >>>> >>>> >>>> >>>> *From:* Anurag Chourasia [mailto:anu...@gm...] >>>> *Sent:* Wednesday, April 03, 2013 4:46 PM >>>> *To:* cx-...@li...; re...@gm... >>>> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: >>>> unimplemented or unreasonable conversion requested >>>> >>>> >>>> >>>> I have encountered a problem after implementing these changes (named >>>> parameters in RAW SQL Queries as per Python DB-API) and I am without any >>>> clue at the moment. >>>> >>>> >>>> >>>> These changes worked just fine on my Development Server >>>> >>>> - Windows XP >>>> - Oracle XE SQL*Plus: Release 11.2.0.2.0 >>>> - cx_Oracle-5.1.2-11g.win32-py2.7 >>>> >>>> >>>> >>>> However, when deployed on my Client's Test Server, execution of all >>>> queries fail with this error. >>>> >>>> - Windows Server 2003 >>>> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi >>>> - cx_Oracle-5.1.2-10g.win32-py2.7 >>>> >>>> >>>> >>>> Traceback (most recent call last): >>>> >>>> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in >>>> regularize_TAG >>>> >>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>> >>>> DatabaseError: ORA-01460: unimplemented or unreasonable conversion >>>> requested >>>> >>>> >>>> >>>> Basically the following code "Works" on my clients machine >>>> >>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>> TAG_NBR = '%s' " %(TAG_NBR)) >>>> >>>> >>>> >>>> But the following code "Does Not Work" >>>> >>>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>>> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>>> >>>> >>>> >>>> Appreciate if someone could help me through this issue. >>>> >>>> >>>> >>>> Regards, >>>> >>>> Anurag >>>> >>>> >>>> >>>> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < >>>> anu...@gm...> wrote: >>>> >>>> Thanks Jani...With that my issue is solved. >>>> >>>> >>>> >>>> Regards >>>> >>>> Guddu >>>> >>>> >>>> >>>> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> wrote: >>>> >>>> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >>>> > *Dear friends...Could you please help me with this issue?* >>>> > >>>> > *Steps to reproduce?* >>>> > 1. Fetch the value of a varchar2 column that has Null as its current >>>> value. >>>> > 2. Use the fetched value to update any table's column. >>>> > >>>> > *Expected output?* >>>> > Instead of updating to Null, the table column gets updated to a >>>> string value of 'None' >>>> > >>>> > *Version in use* >>>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >>>> (Intel)] on win32 >>>> > cx_Oracle - 5.1.2 >>>> > Oracle 11G >>>> > >>>> > *Additional information* >>>> > >>>> > This could be because in the update query, I am using '%s' >>>> format....for example >>>> > >>>> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >>>> > >>>> > But there is no other way. If i simply use >>>> > >>>> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax >>>> error. >>>> > >>>> > There should be a way to update a column to NULL >>>> >>>> Why are you trying to inject data instead of using standard Python API >>>> to do things right? >>>> >>>> If you persists constructing query string completely by hand (like you >>>> have done), then you have to take care of NULL by yourself. >>>> >>>> In most cases following works better: >>>> >>>> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >>>> >>>> When you do it that way Python DB-API takes care of correct quotation >>>> and makes sure that there is no way to inject malicious data and in most >>>> cases correct datatype conversion takes a place (there is few occassions >>>> when this fails) >>>> >>>> cx_Oracle doesn't support %s format, it supports only :name (named) >>>> format [1]. >>>> >>>> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >>>> -- >>>> Jani Tiainen >>>> >>>> - Well planned is half done and a half done has been sufficient >>>> before... >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >>>> Rise to greatness in Intel's independent game demo contest. Compete >>>> for recognition, cash, and the chance to get your game on Steam. >>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo >>>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >>>> _______________________________________________ >>>> cx-oracle-users mailing list >>>> cx-...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>> >>>> >>>> >>>> >>>> ------------------------------ >>>> Confidentiality Note: This electronic message transmission is intended >>>> only for the person or entity to which it is addressed and may contain >>>> information that is privileged, confidential or otherwise protected from >>>> disclosure. If you have received this transmission, but are not the >>>> intended recipient, you are hereby notified that any disclosure, copying, >>>> distribution or use of the contents of this information is strictly >>>> prohibited. If you have received this e-mail in error, please contact >>>> Continuum Performance Systems at {203.245.5000} and delete and destroy >>>> the original message and all copies. >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Minimize network downtime and maximize team effectiveness. >>>> Reduce network management and security costs.Learn how to hire >>>> the most talented Cisco Certified professionals. Visit the >>>> Employer Resources Portal >>>> http://www.cisco.com/web/learning/employer_resources/index.html >>>> >>>> _______________________________________________ >>>> cx-oracle-users mailing list >>>> cx-...@li... >>>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>> >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Minimize network downtime and maximize team effectiveness. >>> Reduce network management and security costs.Learn how to hire >>> the most talented Cisco Certified professionals. Visit the >>> Employer Resources Portal >>> http://www.cisco.com/web/learning/employer_resources/index.html >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >>> >> >> >> -- >> Amaury Forgeot d'Arc >> >> >> ------------------------------------------------------------------------------ >> Minimize network downtime and maximize team effectiveness. >> Reduce network management and security costs.Learn how to hire >> the most talented Cisco Certified professionals. Visit the >> Employer Resources Portal >> http://www.cisco.com/web/learning/employer_resources/index.html >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > -- Amaury Forgeot d'Arc |
From: Anurag C. <anu...@gm...> - 2013-04-03 23:26:58
|
Type of TAG_NBR in Python is <type 'str'> TAG_HIST.TAG_NBR column is varchar2 (100) In this particular example, the value of TAG_NBR was 'ABC' Regards, Anurag On Wed, Apr 3, 2013 at 6:48 PM, Amaury Forgeot d'Arc <ama...@gm...>wrote: > Hi, > > 2013/4/3 Anurag Chourasia <anu...@gm...> > >> Hi Joel, >> >> Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could >> that be a problem? Given that on the same server >> >> This 'Works Fine' >> >> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) >> >> ......but this 'Does Not' >> >> cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >> >> > What is the type of the TAG_NBR variable in Python? > And what is the type of the TAG_HIST.TAG_NBR column? > > >> Regards, >> Anurag >> >> On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...> wrote: >> >>> 64-bit server but using 32-bit cx_oracle? >>> >>> >>> >>> *From:* Anurag Chourasia [mailto:anu...@gm...] >>> *Sent:* Wednesday, April 03, 2013 4:46 PM >>> *To:* cx-...@li...; re...@gm... >>> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: >>> unimplemented or unreasonable conversion requested >>> >>> >>> >>> I have encountered a problem after implementing these changes (named >>> parameters in RAW SQL Queries as per Python DB-API) and I am without any >>> clue at the moment. >>> >>> >>> >>> These changes worked just fine on my Development Server >>> >>> - Windows XP >>> - Oracle XE SQL*Plus: Release 11.2.0.2.0 >>> - cx_Oracle-5.1.2-11g.win32-py2.7 >>> >>> >>> >>> However, when deployed on my Client's Test Server, execution of all >>> queries fail with this error. >>> >>> - Windows Server 2003 >>> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi >>> - cx_Oracle-5.1.2-10g.win32-py2.7 >>> >>> >>> >>> Traceback (most recent call last): >>> >>> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in >>> regularize_TAG >>> >>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>> >>> DatabaseError: ORA-01460: unimplemented or unreasonable conversion >>> requested >>> >>> >>> >>> Basically the following code "Works" on my clients machine >>> >>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>> TAG_NBR = '%s' " %(TAG_NBR)) >>> >>> >>> >>> But the following code "Does Not Work" >>> >>> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >>> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >>> >>> >>> >>> Appreciate if someone could help me through this issue. >>> >>> >>> >>> Regards, >>> >>> Anurag >>> >>> >>> >>> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < >>> anu...@gm...> wrote: >>> >>> Thanks Jani...With that my issue is solved. >>> >>> >>> >>> Regards >>> >>> Guddu >>> >>> >>> >>> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> wrote: >>> >>> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >>> > *Dear friends...Could you please help me with this issue?* >>> > >>> > *Steps to reproduce?* >>> > 1. Fetch the value of a varchar2 column that has Null as its current >>> value. >>> > 2. Use the fetched value to update any table's column. >>> > >>> > *Expected output?* >>> > Instead of updating to Null, the table column gets updated to a string >>> value of 'None' >>> > >>> > *Version in use* >>> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >>> (Intel)] on win32 >>> > cx_Oracle - 5.1.2 >>> > Oracle 11G >>> > >>> > *Additional information* >>> > >>> > This could be because in the update query, I am using '%s' >>> format....for example >>> > >>> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >>> > >>> > But there is no other way. If i simply use >>> > >>> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax >>> error. >>> > >>> > There should be a way to update a column to NULL >>> >>> Why are you trying to inject data instead of using standard Python API >>> to do things right? >>> >>> If you persists constructing query string completely by hand (like you >>> have done), then you have to take care of NULL by yourself. >>> >>> In most cases following works better: >>> >>> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >>> >>> When you do it that way Python DB-API takes care of correct quotation >>> and makes sure that there is no way to inject malicious data and in most >>> cases correct datatype conversion takes a place (there is few occassions >>> when this fails) >>> >>> cx_Oracle doesn't support %s format, it supports only :name (named) >>> format [1]. >>> >>> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >>> -- >>> Jani Tiainen >>> >>> - Well planned is half done and a half done has been sufficient before... >>> >>> >>> ------------------------------------------------------------------------------ >>> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >>> Rise to greatness in Intel's independent game demo contest. Compete >>> for recognition, cash, and the chance to get your game on Steam. >>> $5K grand prize plus 10 genre and skill prizes. Submit your demo >>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >>> >>> >>> >>> ------------------------------ >>> Confidentiality Note: This electronic message transmission is intended >>> only for the person or entity to which it is addressed and may contain >>> information that is privileged, confidential or otherwise protected from >>> disclosure. If you have received this transmission, but are not the >>> intended recipient, you are hereby notified that any disclosure, copying, >>> distribution or use of the contents of this information is strictly >>> prohibited. If you have received this e-mail in error, please contact >>> Continuum Performance Systems at {203.245.5000} and delete and destroy >>> the original message and all copies. >>> >>> >>> ------------------------------------------------------------------------------ >>> Minimize network downtime and maximize team effectiveness. >>> Reduce network management and security costs.Learn how to hire >>> the most talented Cisco Certified professionals. Visit the >>> Employer Resources Portal >>> http://www.cisco.com/web/learning/employer_resources/index.html >>> >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Minimize network downtime and maximize team effectiveness. >> Reduce network management and security costs.Learn how to hire >> the most talented Cisco Certified professionals. Visit the >> Employer Resources Portal >> http://www.cisco.com/web/learning/employer_resources/index.html >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > > -- > Amaury Forgeot d'Arc > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Amaury F. d'A. <ama...@gm...> - 2013-04-03 22:48:58
|
Hi, 2013/4/3 Anurag Chourasia <anu...@gm...> > Hi Joel, > > Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could > that be a problem? Given that on the same server > > This 'Works Fine' > > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) > > ......but this 'Does Not' > > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > What is the type of the TAG_NBR variable in Python? And what is the type of the TAG_HIST.TAG_NBR column? > Regards, > Anurag > > On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...> wrote: > >> 64-bit server but using 32-bit cx_oracle? >> >> >> >> *From:* Anurag Chourasia [mailto:anu...@gm...] >> *Sent:* Wednesday, April 03, 2013 4:46 PM >> *To:* cx-...@li...; re...@gm... >> *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: >> unimplemented or unreasonable conversion requested >> >> >> >> I have encountered a problem after implementing these changes (named >> parameters in RAW SQL Queries as per Python DB-API) and I am without any >> clue at the moment. >> >> >> >> These changes worked just fine on my Development Server >> >> - Windows XP >> - Oracle XE SQL*Plus: Release 11.2.0.2.0 >> - cx_Oracle-5.1.2-11g.win32-py2.7 >> >> >> >> However, when deployed on my Client's Test Server, execution of all >> queries fail with this error. >> >> - Windows Server 2003 >> - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi >> - cx_Oracle-5.1.2-10g.win32-py2.7 >> >> >> >> Traceback (most recent call last): >> >> File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in >> regularize_TAG >> >> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >> >> DatabaseError: ORA-01460: unimplemented or unreasonable conversion >> requested >> >> >> >> Basically the following code "Works" on my clients machine >> >> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >> TAG_NBR = '%s' " %(TAG_NBR)) >> >> >> >> But the following code "Does Not Work" >> >> T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE >> TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) >> >> >> >> Appreciate if someone could help me through this issue. >> >> >> >> Regards, >> >> Anurag >> >> >> >> On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < >> anu...@gm...> wrote: >> >> Thanks Jani...With that my issue is solved. >> >> >> >> Regards >> >> Guddu >> >> >> >> On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> wrote: >> >> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >> > *Dear friends...Could you please help me with this issue?* >> > >> > *Steps to reproduce?* >> > 1. Fetch the value of a varchar2 column that has Null as its current >> value. >> > 2. Use the fetched value to update any table's column. >> > >> > *Expected output?* >> > Instead of updating to Null, the table column gets updated to a string >> value of 'None' >> > >> > *Version in use* >> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >> (Intel)] on win32 >> > cx_Oracle - 5.1.2 >> > Oracle 11G >> > >> > *Additional information* >> > >> > This could be because in the update query, I am using '%s' >> format....for example >> > >> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >> > >> > But there is no other way. If i simply use >> > >> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax >> error. >> > >> > There should be a way to update a column to NULL >> >> Why are you trying to inject data instead of using standard Python API >> to do things right? >> >> If you persists constructing query string completely by hand (like you >> have done), then you have to take care of NULL by yourself. >> >> In most cases following works better: >> >> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >> >> When you do it that way Python DB-API takes care of correct quotation >> and makes sure that there is no way to inject malicious data and in most >> cases correct datatype conversion takes a place (there is few occassions >> when this fails) >> >> cx_Oracle doesn't support %s format, it supports only :name (named) >> format [1]. >> >> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >> -- >> Jani Tiainen >> >> - Well planned is half done and a half done has been sufficient before... >> >> >> ------------------------------------------------------------------------------ >> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >> Rise to greatness in Intel's independent game demo contest. Compete >> for recognition, cash, and the chance to get your game on Steam. >> $5K grand prize plus 10 genre and skill prizes. Submit your demo >> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> >> >> >> ------------------------------ >> Confidentiality Note: This electronic message transmission is intended >> only for the person or entity to which it is addressed and may contain >> information that is privileged, confidential or otherwise protected from >> disclosure. If you have received this transmission, but are not the >> intended recipient, you are hereby notified that any disclosure, copying, >> distribution or use of the contents of this information is strictly >> prohibited. If you have received this e-mail in error, please contact >> Continuum Performance Systems at {203.245.5000} and delete and destroy >> the original message and all copies. >> >> >> ------------------------------------------------------------------------------ >> Minimize network downtime and maximize team effectiveness. >> Reduce network management and security costs.Learn how to hire >> the most talented Cisco Certified professionals. Visit the >> Employer Resources Portal >> http://www.cisco.com/web/learning/employer_resources/index.html >> >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > -- Amaury Forgeot d'Arc |
From: Tamás G. <gt...@gt...> - 2013-04-03 21:20:14
|
What is in TAG_NBR? It seems that cx_Oracle does not recognize it, it is not a number, string or date. As you stringify it ('%s' % TAG_NBR), the problem is solved. So one solution can be T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR': str(TAG_NBR)}) 2013/4/3 <cx-...@li...> > Send cx-oracle-users mailing list submissions to > cx-...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > or, via email, send a message with subject or body 'help' to > cx-...@li... > > You can reach the person managing the list at > cx-...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of cx-oracle-users digest..." > > > Today's Topics: > > 1. Re: Named Parameters Issue - ORA-01460: unimplemented or > unreasonable conversion requested (Anurag Chourasia) > 2. Re: Named Parameters Issue - ORA-01460: unimplemented or > unreasonable conversion requested (Joel Slowik) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 3 Apr 2013 16:55:56 -0400 > From: Anurag Chourasia <anu...@gm...> > Subject: Re: [cx-oracle-users] Named Parameters Issue - ORA-01460: > unimplemented or unreasonable conversion requested > To: cx-...@li..., js...@cp... > Message-ID: > < > CAN...@ma...> > Content-Type: text/plain; charset="iso-8859-1" > > Hi Joel, > > Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could that > be a problem? Given that on the same server > > This 'Works Fine' > > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = '%s' " %(TAG_NBR)) > > ......but this 'Does Not' > > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > Regards, > Anurag > > On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...> wrote: > > > 64-bit server but using 32-bit cx_oracle? > > > > > > > > *From:* Anurag Chourasia [mailto:anu...@gm...] > > *Sent:* Wednesday, April 03, 2013 4:46 PM > > *To:* cx-...@li...; re...@gm... > > *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: > > unimplemented or unreasonable conversion requested > > > > > > > > I have encountered a problem after implementing these changes (named > > parameters in RAW SQL Queries as per Python DB-API) and I am without any > > clue at the moment. > > > > > > > > These changes worked just fine on my Development Server > > > > - Windows XP > > - Oracle XE SQL*Plus: Release 11.2.0.2.0 > > - cx_Oracle-5.1.2-11g.win32-py2.7 > > > > > > > > However, when deployed on my Client's Test Server, execution of all > > queries fail with this error. > > > > - Windows Server 2003 > > - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi > > - cx_Oracle-5.1.2-10g.win32-py2.7 > > > > > > > > Traceback (most recent call last): > > > > File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in > > regularize_TAG > > > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > > > DatabaseError: ORA-01460: unimplemented or unreasonable conversion > > requested > > > > > > > > Basically the following code "Works" on my clients machine > > > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > > TAG_NBR = '%s' " %(TAG_NBR)) > > > > > > > > But the following code "Does Not Work" > > > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > > > > > > > Appreciate if someone could help me through this issue. > > > > > > > > Regards, > > > > Anurag > > > > > > > > On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < > > anu...@gm...> wrote: > > > > Thanks Jani...With that my issue is solved. > > > > > > > > Regards > > > > Guddu > > > > > > > > On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> wrote: > > > > 2.4.2013 5:51, Anurag Chourasia kirjoitti: > > > *Dear friends...Could you please help me with this issue?* > > > > > > *Steps to reproduce?* > > > 1. Fetch the value of a varchar2 column that has Null as its current > > value. > > > 2. Use the fetched value to update any table's column. > > > > > > *Expected output?* > > > Instead of updating to Null, the table column gets updated to a string > > value of 'None' > > > > > > *Version in use* > > > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit > > (Intel)] on win32 > > > cx_Oracle - 5.1.2 > > > Oracle 11G > > > > > > *Additional information* > > > > > > This could be because in the update query, I am using '%s' > format....for > > example > > > > > > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > > > > > > But there is no other way. If i simply use > > > > > > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax > > error. > > > > > > There should be a way to update a column to NULL > > > > Why are you trying to inject data instead of using standard Python API > > to do things right? > > > > If you persists constructing query string completely by hand (like you > > have done), then you have to take care of NULL by yourself. > > > > In most cases following works better: > > > > cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) > > > > When you do it that way Python DB-API takes care of correct quotation > > and makes sure that there is no way to inject malicious data and in most > > cases correct datatype conversion takes a place (there is few occassions > > when this fails) > > > > cx_Oracle doesn't support %s format, it supports only :name (named) > > format [1]. > > > > [1] http://www.python.org/dev/peps/pep-0249/#paramstyle > > -- > > Jani Tiainen > > > > - Well planned is half done and a half done has been sufficient before... > > > > > > > ------------------------------------------------------------------------------ > > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > > Rise to greatness in Intel's independent game demo contest. Compete > > for recognition, cash, and the chance to get your game on Steam. > > $5K grand prize plus 10 genre and skill prizes. Submit your demo > > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > > _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > > > > > > > ------------------------------ > > Confidentiality Note: This electronic message transmission is intended > > only for the person or entity to which it is addressed and may contain > > information that is privileged, confidential or otherwise protected from > > disclosure. If you have received this transmission, but are not the > > intended recipient, you are hereby notified that any disclosure, copying, > > distribution or use of the contents of this information is strictly > > prohibited. If you have received this e-mail in error, please contact > > Continuum Performance Systems at {203.245.5000} and delete and destroy > > the original message and all copies. > > > > > > > ------------------------------------------------------------------------------ > > Minimize network downtime and maximize team effectiveness. > > Reduce network management and security costs.Learn how to hire > > the most talented Cisco Certified professionals. Visit the > > Employer Resources Portal > > http://www.cisco.com/web/learning/employer_resources/index.html > > _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > Message: 2 > Date: Wed, 3 Apr 2013 21:11:53 +0000 > From: Joel Slowik <js...@cp...> > Subject: Re: [cx-oracle-users] Named Parameters Issue - ORA-01460: > unimplemented or unreasonable conversion requested > To: 'Anurag Chourasia' <anu...@gm...>, > "cx-...@li..." > <cx-...@li...> > Message-ID: > < > e05...@BL...> > > Content-Type: text/plain; charset="us-ascii" > > As I understand it, whatever version of cx_oracle you have should have > been compiled for whatever version of oracle you are using. I just tested a > variant of your code that "does not work" on my system and it returned a > value. Short of you using an incompatible version there are a few other > reasons why you would get ORA-01460 but I would start there. > > From: Anurag Chourasia [mailto:anu...@gm...] > Sent: Wednesday, April 03, 2013 4:56 PM > To: cx-...@li...; Joel Slowik > Subject: Re: [cx-oracle-users] Named Parameters Issue - ORA-01460: > unimplemented or unreasonable conversion requested > > Hi Joel, > > Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could > that be a problem? Given that on the same server > > This 'Works Fine' > > > > > > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = > '%s' " %(TAG_NBR)) > ......but this 'Does Not' > > > > > > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = > :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > Regards, > Anurag > On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...<mailto: > js...@cp...>> wrote: > 64-bit server but using 32-bit cx_oracle? > > From: Anurag Chourasia [mailto:anu...@gm...<mailto: > anu...@gm...>] > Sent: Wednesday, April 03, 2013 4:46 PM > To: cx-...@li...<mailto: > cx-...@li...>; re...@gm...<mailto: > re...@gm...> > Subject: [cx-oracle-users] Named Parameters Issue - ORA-01460: > unimplemented or unreasonable conversion requested > > I have encountered a problem after implementing these changes (named > parameters in RAW SQL Queries as per Python DB-API) and I am without any > clue at the moment. > > These changes worked just fine on my Development Server > > * Windows XP > * Oracle XE SQL*Plus: Release 11.2.0.2.0 > * cx_Oracle-5.1.2-11g.win32-py2.7 > > However, when deployed on my Client's Test Server, execution of all > queries fail with this error. > > * Windows Server 2003 > * Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi > * cx_Oracle-5.1.2-10g.win32-py2.7 > > Traceback (most recent call last): > File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in > regularize_TAG > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > DatabaseError: ORA-01460: unimplemented or unreasonable conversion > requested > > Basically the following code "Works" on my clients machine > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = '%s' " %(TAG_NBR)) > > But the following code "Does Not Work" > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > Appreciate if someone could help me through this issue. > > Regards, > Anurag > > On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < > anu...@gm...<mailto:anu...@gm...>> wrote: > Thanks Jani...With that my issue is solved. > > Regards > Guddu > > On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...<mailto: > re...@gm...>> wrote: > 2.4.2013 5:51, Anurag Chourasia kirjoitti: > > *Dear friends...Could you please help me with this issue?* > > > > *Steps to reproduce?* > > 1. Fetch the value of a varchar2 column that has Null as its current > value. > > 2. Use the fetched value to update any table's column. > > > > *Expected output?* > > Instead of updating to Null, the table column gets updated to a string > value of 'None' > > > > *Version in use* > > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit > (Intel)] on win32 > > cx_Oracle - 5.1.2 > > Oracle 11G > > > > *Additional information* > > > > This could be because in the update query, I am using '%s' format....for > example > > > > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > > > > But there is no other way. If i simply use > > > > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax > error. > > > > There should be a way to update a column to NULL > > Why are you trying to inject data instead of using standard Python API > to do things right? > > If you persists constructing query string completely by hand (like you > have done), then you have to take care of NULL by yourself. > > In most cases following works better: > > cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) > > When you do it that way Python DB-API takes care of correct quotation > and makes sure that there is no way to inject malicious data and in most > cases correct datatype conversion takes a place (there is few occassions > when this fails) > > cx_Oracle doesn't support %s format, it supports only :name (named) > format [1]. > > [1] http://www.python.org/dev/peps/pep-0249/#paramstyle > -- > Jani Tiainen > > - Well planned is half done and a half done has been sufficient before... > > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li...<mailto: > cx-...@li...> > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ________________________________ > Confidentiality Note: This electronic message transmission is intended > only for the person or entity to which it is addressed and may contain > information that is privileged, confidential or otherwise protected from > disclosure. If you have received this transmission, but are not the > intended recipient, you are hereby notified that any disclosure, copying, > distribution or use of the contents of this information is strictly > prohibited. If you have received this e-mail in error, please contact > Continuum Performance Systems at {203.245.5000<tel:203.245.5000>} and > delete and destroy the original message and all copies. > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > cx-oracle-users mailing list > cx-...@li...<mailto: > cx-...@li...> > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > ________________________________ > Confidentiality Note: This electronic message transmission is intended > only for the person or entity to which it is addressed and may contain > information that is privileged, confidential or otherwise protected from > disclosure. If you have received this transmission, but are not the > intended recipient, you are hereby notified that any disclosure, copying, > distribution or use of the contents of this information is strictly > prohibited. If you have received this e-mail in error, please contact > Continuum Performance Systems at {203.245.5000} and delete and destroy > the original message and all copies. > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > > ------------------------------ > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > End of cx-oracle-users Digest, Vol 81, Issue 3 > ********************************************** > |
From: Anurag C. <anu...@gm...> - 2013-04-03 21:15:37
|
Thanks, I will try with the 64 Bit version instead of 32 Bit Version and report back the results. Regards, Anurag On Wed, Apr 3, 2013 at 5:11 PM, Joel Slowik <js...@cp...> wrote: > As I understand it, whatever version of cx_oracle you have should have > been compiled for whatever version of oracle you are using. I just tested a > variant of your code that “does not work” on my system and it returned a > value. Short of you using an incompatible version there are a few other > reasons why you would get ORA-01460 but I would start there. > > > > *From:* Anurag Chourasia [mailto:anu...@gm...] > *Sent:* Wednesday, April 03, 2013 4:56 PM > *To:* cx-...@li...; Joel Slowik > *Subject:* Re: [cx-oracle-users] Named Parameters Issue - ORA-01460: > unimplemented or unreasonable conversion requested > > > > Hi Joel, > > > > Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could > that be a problem? Given that on the same server > > > > This 'Works Fine' > > > > > > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) > > ......but this 'Does Not' > > > > > > cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > Regards, > > Anurag > > On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...> wrote: > > 64-bit server but using 32-bit cx_oracle? > > > > *From:* Anurag Chourasia [mailto:anu...@gm...] > *Sent:* Wednesday, April 03, 2013 4:46 PM > *To:* cx-...@li...; re...@gm... > *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: > unimplemented or unreasonable conversion requested > > > > I have encountered a problem after implementing these changes (named > parameters in RAW SQL Queries as per Python DB-API) and I am without any > clue at the moment. > > > > These changes worked just fine on my Development Server > > - Windows XP > - Oracle XE SQL*Plus: Release 11.2.0.2.0 > - cx_Oracle-5.1.2-11g.win32-py2.7 > > > > However, when deployed on my Client's Test Server, execution of all > queries fail with this error. > > - Windows Server 2003 > - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi > - cx_Oracle-5.1.2-10g.win32-py2.7 > > > > Traceback (most recent call last): > > File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in > regularize_TAG > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > DatabaseError: ORA-01460: unimplemented or unreasonable conversion > requested > > > > Basically the following code "Works" on my clients machine > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = '%s' " %(TAG_NBR)) > > > > But the following code "Does Not Work" > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > > > Appreciate if someone could help me through this issue. > > > > Regards, > > Anurag > > > > On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < > anu...@gm...> wrote: > > Thanks Jani...With that my issue is solved. > > > > Regards > > Guddu > > > > On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> wrote: > > 2.4.2013 5:51, Anurag Chourasia kirjoitti: > > *Dear friends...Could you please help me with this issue?* > > > > *Steps to reproduce?* > > 1. Fetch the value of a varchar2 column that has Null as its current > value. > > 2. Use the fetched value to update any table's column. > > > > *Expected output?* > > Instead of updating to Null, the table column gets updated to a string > value of 'None' > > > > *Version in use* > > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit > (Intel)] on win32 > > cx_Oracle - 5.1.2 > > Oracle 11G > > > > *Additional information* > > > > This could be because in the update query, I am using '%s' format....for > example > > > > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > > > > But there is no other way. If i simply use > > > > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax > error. > > > > There should be a way to update a column to NULL > > Why are you trying to inject data instead of using standard Python API > to do things right? > > If you persists constructing query string completely by hand (like you > have done), then you have to take care of NULL by yourself. > > In most cases following works better: > > cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) > > When you do it that way Python DB-API takes care of correct quotation > and makes sure that there is no way to inject malicious data and in most > cases correct datatype conversion takes a place (there is few occassions > when this fails) > > cx_Oracle doesn't support %s format, it supports only :name (named) > format [1]. > > [1] http://www.python.org/dev/peps/pep-0249/#paramstyle > -- > Jani Tiainen > > - Well planned is half done and a half done has been sufficient before... > > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > > ------------------------------ > > Confidentiality Note: This electronic message transmission is intended > only for the person or entity to which it is addressed and may contain > information that is privileged, confidential or otherwise protected from > disclosure. If you have received this transmission, but are not the > intended recipient, you are hereby notified that any disclosure, copying, > distribution or use of the contents of this information is strictly > prohibited. If you have received this e-mail in error, please contact > Continuum Performance Systems at {203.245.5000} and delete and destroy > the original message and all copies. > > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ------------------------------ > Confidentiality Note: This electronic message transmission is intended > only for the person or entity to which it is addressed and may contain > information that is privileged, confidential or otherwise protected from > disclosure. If you have received this transmission, but are not the > intended recipient, you are hereby notified that any disclosure, copying, > distribution or use of the contents of this information is strictly > prohibited. If you have received this e-mail in error, please contact > Continuum Performance Systems at {203.245.5000} and delete and destroy > the original message and all copies. > |
From: Joel S. <js...@cp...> - 2013-04-03 21:12:17
|
As I understand it, whatever version of cx_oracle you have should have been compiled for whatever version of oracle you are using. I just tested a variant of your code that "does not work" on my system and it returned a value. Short of you using an incompatible version there are a few other reasons why you would get ORA-01460 but I would start there. From: Anurag Chourasia [mailto:anu...@gm...] Sent: Wednesday, April 03, 2013 4:56 PM To: cx-...@li...; Joel Slowik Subject: Re: [cx-oracle-users] Named Parameters Issue - ORA-01460: unimplemented or unreasonable conversion requested Hi Joel, Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could that be a problem? Given that on the same server This 'Works Fine' cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) ......but this 'Does Not' cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) Regards, Anurag On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...<mailto:js...@cp...>> wrote: 64-bit server but using 32-bit cx_oracle? From: Anurag Chourasia [mailto:anu...@gm...<mailto:anu...@gm...>] Sent: Wednesday, April 03, 2013 4:46 PM To: cx-...@li...<mailto:cx-...@li...>; re...@gm...<mailto:re...@gm...> Subject: [cx-oracle-users] Named Parameters Issue - ORA-01460: unimplemented or unreasonable conversion requested I have encountered a problem after implementing these changes (named parameters in RAW SQL Queries as per Python DB-API) and I am without any clue at the moment. These changes worked just fine on my Development Server * Windows XP * Oracle XE SQL*Plus: Release 11.2.0.2.0 * cx_Oracle-5.1.2-11g.win32-py2.7 However, when deployed on my Client's Test Server, execution of all queries fail with this error. * Windows Server 2003 * Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi * cx_Oracle-5.1.2-10g.win32-py2.7 Traceback (most recent call last): File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in regularize_TAG T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) DatabaseError: ORA-01460: unimplemented or unreasonable conversion requested Basically the following code "Works" on my clients machine T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) But the following code "Does Not Work" T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) Appreciate if someone could help me through this issue. Regards, Anurag On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia <anu...@gm...<mailto:anu...@gm...>> wrote: Thanks Jani...With that my issue is solved. Regards Guddu On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...<mailto:re...@gm...>> wrote: 2.4.2013 5:51, Anurag Chourasia kirjoitti: > *Dear friends...Could you please help me with this issue?* > > *Steps to reproduce?* > 1. Fetch the value of a varchar2 column that has Null as its current value. > 2. Use the fetched value to update any table's column. > > *Expected output?* > Instead of updating to Null, the table column gets updated to a string value of 'None' > > *Version in use* > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 > cx_Oracle - 5.1.2 > Oracle 11G > > *Additional information* > > This could be because in the update query, I am using '%s' format....for example > > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > > But there is no other way. If i simply use > > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax error. > > There should be a way to update a column to NULL Why are you trying to inject data instead of using standard Python API to do things right? If you persists constructing query string completely by hand (like you have done), then you have to take care of NULL by yourself. In most cases following works better: cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) When you do it that way Python DB-API takes care of correct quotation and makes sure that there is no way to inject malicious data and in most cases correct datatype conversion takes a place (there is few occassions when this fails) cx_Oracle doesn't support %s format, it supports only :name (named) format [1]. [1] http://www.python.org/dev/peps/pep-0249/#paramstyle -- Jani Tiainen - Well planned is half done and a half done has been sufficient before... ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 _______________________________________________ cx-oracle-users mailing list cx-...@li...<mailto:cx-...@li...> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users ________________________________ Confidentiality Note: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact Continuum Performance Systems at {203.245.5000<tel:203.245.5000>} and delete and destroy the original message and all copies. ------------------------------------------------------------------------------ Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ cx-oracle-users mailing list cx-...@li...<mailto:cx-...@li...> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users ________________________________ Confidentiality Note: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact Continuum Performance Systems at {203.245.5000} and delete and destroy the original message and all copies. |
From: Anurag C. <anu...@gm...> - 2013-04-03 20:56:24
|
Hi Joel, Yes. It is a 64 Bit Server using 32 Bit version of cx_Oracle.....Could that be a problem? Given that on the same server This 'Works Fine' cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) ......but this 'Does Not' cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) Regards, Anurag On Wed, Apr 3, 2013 at 4:50 PM, Joel Slowik <js...@cp...> wrote: > 64-bit server but using 32-bit cx_oracle? > > > > *From:* Anurag Chourasia [mailto:anu...@gm...] > *Sent:* Wednesday, April 03, 2013 4:46 PM > *To:* cx-...@li...; re...@gm... > *Subject:* [cx-oracle-users] Named Parameters Issue - ORA-01460: > unimplemented or unreasonable conversion requested > > > > I have encountered a problem after implementing these changes (named > parameters in RAW SQL Queries as per Python DB-API) and I am without any > clue at the moment. > > > > These changes worked just fine on my Development Server > > - Windows XP > - Oracle XE SQL*Plus: Release 11.2.0.2.0 > - cx_Oracle-5.1.2-11g.win32-py2.7 > > > > However, when deployed on my Client's Test Server, execution of all > queries fail with this error. > > - Windows Server 2003 > - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi > - cx_Oracle-5.1.2-10g.win32-py2.7 > > > > Traceback (most recent call last): > > File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in > regularize_TAG > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > DatabaseError: ORA-01460: unimplemented or unreasonable conversion > requested > > > > Basically the following code "Works" on my clients machine > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = '%s' " %(TAG_NBR)) > > > > But the following code "Does Not Work" > > T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE > TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) > > > > Appreciate if someone could help me through this issue. > > > > Regards, > > Anurag > > > > On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia < > anu...@gm...> wrote: > > Thanks Jani...With that my issue is solved. > > > > Regards > > Guddu > > > > On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> wrote: > > 2.4.2013 5:51, Anurag Chourasia kirjoitti: > > *Dear friends...Could you please help me with this issue?* > > > > *Steps to reproduce?* > > 1. Fetch the value of a varchar2 column that has Null as its current > value. > > 2. Use the fetched value to update any table's column. > > > > *Expected output?* > > Instead of updating to Null, the table column gets updated to a string > value of 'None' > > > > *Version in use* > > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit > (Intel)] on win32 > > cx_Oracle - 5.1.2 > > Oracle 11G > > > > *Additional information* > > > > This could be because in the update query, I am using '%s' format....for > example > > > > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > > > > But there is no other way. If i simply use > > > > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax > error. > > > > There should be a way to update a column to NULL > > Why are you trying to inject data instead of using standard Python API > to do things right? > > If you persists constructing query string completely by hand (like you > have done), then you have to take care of NULL by yourself. > > In most cases following works better: > > cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) > > When you do it that way Python DB-API takes care of correct quotation > and makes sure that there is no way to inject malicious data and in most > cases correct datatype conversion takes a place (there is few occassions > when this fails) > > cx_Oracle doesn't support %s format, it supports only :name (named) > format [1]. > > [1] http://www.python.org/dev/peps/pep-0249/#paramstyle > -- > Jani Tiainen > > - Well planned is half done and a half done has been sufficient before... > > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > > ------------------------------ > Confidentiality Note: This electronic message transmission is intended > only for the person or entity to which it is addressed and may contain > information that is privileged, confidential or otherwise protected from > disclosure. If you have received this transmission, but are not the > intended recipient, you are hereby notified that any disclosure, copying, > distribution or use of the contents of this information is strictly > prohibited. If you have received this e-mail in error, please contact > Continuum Performance Systems at {203.245.5000} and delete and destroy > the original message and all copies. > > > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Joel S. <js...@cp...> - 2013-04-03 20:50:35
|
64-bit server but using 32-bit cx_oracle? From: Anurag Chourasia [mailto:anu...@gm...] Sent: Wednesday, April 03, 2013 4:46 PM To: cx-...@li...; re...@gm... Subject: [cx-oracle-users] Named Parameters Issue - ORA-01460: unimplemented or unreasonable conversion requested I have encountered a problem after implementing these changes (named parameters in RAW SQL Queries as per Python DB-API) and I am without any clue at the moment. These changes worked just fine on my Development Server * Windows XP * Oracle XE SQL*Plus: Release 11.2.0.2.0 * cx_Oracle-5.1.2-11g.win32-py2.7 However, when deployed on my Client's Test Server, execution of all queries fail with this error. * Windows Server 2003 * Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi * cx_Oracle-5.1.2-10g.win32-py2.7 Traceback (most recent call last): File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in regularize_TAG T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) DatabaseError: ORA-01460: unimplemented or unreasonable conversion requested Basically the following code "Works" on my clients machine T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) But the following code "Does Not Work" T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) Appreciate if someone could help me through this issue. Regards, Anurag On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia <anu...@gm...<mailto:anu...@gm...>> wrote: Thanks Jani...With that my issue is solved. Regards Guddu On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...<mailto:re...@gm...>> wrote: 2.4.2013 5:51, Anurag Chourasia kirjoitti: > *Dear friends...Could you please help me with this issue?* > > *Steps to reproduce?* > 1. Fetch the value of a varchar2 column that has Null as its current value. > 2. Use the fetched value to update any table's column. > > *Expected output?* > Instead of updating to Null, the table column gets updated to a string value of 'None' > > *Version in use* > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 > cx_Oracle - 5.1.2 > Oracle 11G > > *Additional information* > > This could be because in the update query, I am using '%s' format....for example > > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > > But there is no other way. If i simply use > > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax error. > > There should be a way to update a column to NULL Why are you trying to inject data instead of using standard Python API to do things right? If you persists constructing query string completely by hand (like you have done), then you have to take care of NULL by yourself. In most cases following works better: cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) When you do it that way Python DB-API takes care of correct quotation and makes sure that there is no way to inject malicious data and in most cases correct datatype conversion takes a place (there is few occassions when this fails) cx_Oracle doesn't support %s format, it supports only :name (named) format [1]. [1] http://www.python.org/dev/peps/pep-0249/#paramstyle -- Jani Tiainen - Well planned is half done and a half done has been sufficient before... ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 _______________________________________________ cx-oracle-users mailing list cx-...@li...<mailto:cx-...@li...> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users ________________________________ Confidentiality Note: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact Continuum Performance Systems at {203.245.5000} and delete and destroy the original message and all copies. |
From: Anurag C. <anu...@gm...> - 2013-04-03 20:46:57
|
I have encountered a problem after implementing these changes (named parameters in RAW SQL Queries as per Python DB-API) and I am without any clue at the moment. These changes worked just fine on my Development Server - Windows XP - Oracle XE SQL*Plus: Release 11.2.0.2.0 - cx_Oracle-5.1.2-11g.win32-py2.7 However, when deployed on my Client's Test Server, execution of all queries fail with this error. - Windows Server 2003 - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi - cx_Oracle-5.1.2-10g.win32-py2.7 Traceback (most recent call last): File "C:/Program Files/App_Logic/..\apps\views.py", line 400, in regularize_TAG T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) DatabaseError: ORA-01460: unimplemented or unreasonable conversion requested Basically the following code "Works" on my clients machine T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = '%s' " %(TAG_NBR)) But the following code "Does Not Work" T_cursor.execute("SELECT DISTINCT(TAG_STATUS) FROM TAG_HIST WHERE TAG_NBR = :TAG_NBR " ,{'TAG_NBR':TAG_NBR}) Appreciate if someone could help me through this issue. Regards, Anurag On Tue, Apr 2, 2013 at 5:38 PM, Anurag Chourasia <anu...@gm... > wrote: > Thanks Jani...With that my issue is solved. > > Regards > Guddu > > > On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> wrote: > >> 2.4.2013 5:51, Anurag Chourasia kirjoitti: >> > *Dear friends...Could you please help me with this issue?* >> > >> > *Steps to reproduce?* >> > 1. Fetch the value of a varchar2 column that has Null as its current >> value. >> > 2. Use the fetched value to update any table's column. >> > >> > *Expected output?* >> > Instead of updating to Null, the table column gets updated to a string >> value of 'None' >> > >> > *Version in use* >> > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit >> (Intel)] on win32 >> > cx_Oracle - 5.1.2 >> > Oracle 11G >> > >> > *Additional information* >> > >> > This could be because in the update query, I am using '%s' >> format....for example >> > >> > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) >> > >> > But there is no other way. If i simply use >> > >> > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax >> error. >> > >> > There should be a way to update a column to NULL >> >> Why are you trying to inject data instead of using standard Python API >> to do things right? >> >> If you persists constructing query string completely by hand (like you >> have done), then you have to take care of NULL by yourself. >> >> In most cases following works better: >> >> cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) >> >> When you do it that way Python DB-API takes care of correct quotation >> and makes sure that there is no way to inject malicious data and in most >> cases correct datatype conversion takes a place (there is few occassions >> when this fails) >> >> cx_Oracle doesn't support %s format, it supports only :name (named) >> format [1]. >> >> [1] http://www.python.org/dev/peps/pep-0249/#paramstyle >> -- >> Jani Tiainen >> >> - Well planned is half done and a half done has been sufficient before... >> >> >> ------------------------------------------------------------------------------ >> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >> Rise to greatness in Intel's independent game demo contest. Compete >> for recognition, cash, and the chance to get your game on Steam. >> $5K grand prize plus 10 genre and skill prizes. Submit your demo >> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> > > |
From: Anurag C. <anu...@gm...> - 2013-04-02 21:39:13
|
Thanks Jani...With that my issue is solved. Regards Guddu On Tue, Apr 2, 2013 at 1:35 AM, Jani Tiainen <re...@gm...> wrote: > 2.4.2013 5:51, Anurag Chourasia kirjoitti: > > *Dear friends...Could you please help me with this issue?* > > > > *Steps to reproduce?* > > 1. Fetch the value of a varchar2 column that has Null as its current > value. > > 2. Use the fetched value to update any table's column. > > > > *Expected output?* > > Instead of updating to Null, the table column gets updated to a string > value of 'None' > > > > *Version in use* > > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit > (Intel)] on win32 > > cx_Oracle - 5.1.2 > > Oracle 11G > > > > *Additional information* > > > > This could be because in the update query, I am using '%s' format....for > example > > > > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > > > > But there is no other way. If i simply use > > > > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax > error. > > > > There should be a way to update a column to NULL > > Why are you trying to inject data instead of using standard Python API > to do things right? > > If you persists constructing query string completely by hand (like you > have done), then you have to take care of NULL by yourself. > > In most cases following works better: > > cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) > > When you do it that way Python DB-API takes care of correct quotation > and makes sure that there is no way to inject malicious data and in most > cases correct datatype conversion takes a place (there is few occassions > when this fails) > > cx_Oracle doesn't support %s format, it supports only :name (named) > format [1]. > > [1] http://www.python.org/dev/peps/pep-0249/#paramstyle > -- > Jani Tiainen > > - Well planned is half done and a half done has been sufficient before... > > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Jani T. <re...@gm...> - 2013-04-02 05:35:50
|
2.4.2013 5:51, Anurag Chourasia kirjoitti: > *Dear friends...Could you please help me with this issue?* > > *Steps to reproduce?* > 1. Fetch the value of a varchar2 column that has Null as its current value. > 2. Use the fetched value to update any table's column. > > *Expected output?* > Instead of updating to Null, the table column gets updated to a string value of 'None' > > *Version in use* > Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 > cx_Oracle - 5.1.2 > Oracle 11G > > *Additional information* > > This could be because in the update query, I am using '%s' format....for example > > cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) > > But there is no other way. If i simply use > > cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax error. > > There should be a way to update a column to NULL Why are you trying to inject data instead of using standard Python API to do things right? If you persists constructing query string completely by hand (like you have done), then you have to take care of NULL by yourself. In most cases following works better: cursor.execute('UPDATE EMP SET NAME=:arg1', {'arg1' : None }) When you do it that way Python DB-API takes care of correct quotation and makes sure that there is no way to inject malicious data and in most cases correct datatype conversion takes a place (there is few occassions when this fails) cx_Oracle doesn't support %s format, it supports only :name (named) format [1]. [1] http://www.python.org/dev/peps/pep-0249/#paramstyle -- Jani Tiainen - Well planned is half done and a half done has been sufficient before... |
From: Anurag C. <anu...@gm...> - 2013-04-02 02:52:17
|
*Dear friends...Could you please help me with this issue?* *Steps to reproduce?* 1. Fetch the value of a varchar2 column that has Null as its current value. 2. Use the fetched value to update any table's column. *Expected output?* Instead of updating to Null, the table column gets updated to a string value of 'None' *Version in use* Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 cx_Oracle - 5.1.2 Oracle 11G *Additional information* This could be because in the update query, I am using '%s' format....for example cursor.execute("UPDATE EMP SET NAME='%s'" %(None)) But there is no other way. If i simply use cursor.execute("UPDATE EMP SET NAME=%s" %(None)) then I get a syntax error. There should be a way to update a column to NULL Regards, Guddu |
From: Amaury F. d'A. <ama...@gm...> - 2013-03-27 22:55:15
|
2013/3/27 James Adams <mon...@gm...> > cx_Oracle.c:6:20: error: Python.h: No such file or directory You probably need the Python development files: yum install python27-devel or something like this -- Amaury Forgeot d'Arc |
From: backdoc <1...@cr...> - 2013-03-27 21:54:50
|
Anthony Tuininga <anthony.tuininga@...> writes: > > You need to find out whether your Oracle client is 32-bit or 64-bit. > Everything must be 64-bit or everything must be 32-bit -- you cannot > mix and match. It looks to me like your Oracle client is 32-bit <snipped> First off, thanks for the library. Secondly, thank you for the tip below. It fixed my problem. |
From: James A. <mon...@gm...> - 2013-03-27 21:42:37
|
I have attempted to install cx_Oracle onto a CentOS 6.3 system but it seems that I've failed somehow. I have used the RPM for my environment (Oracle 11g and Python 2.7.3, http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-5.1.2-11g-py27-1.x86_64.rpm?download) and installed this using rpm, like so: rpm -ivh cx_Oracle-5.1.2-11g-py27-1.x86_64.rpm This command appears to run without error, however when I try using cx_Oracle in Python I get an import error: >>> import cx_Oracle Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named cx_Oracle So apparently I've not yet done everything I need to do in order to use the cx_Oracle module. Can anyone advise as to what else I need to do? One thought is that since I'm on CentOS 6.x then the RPM files available from the cx_Oracle page aren't valid since they're listed as RPMs for CentOS 5 and therefore perhaps not forward compatible. If this is the case then do I need to build from source on my platform? I've actually tried doing this already and immediately ran into compilation errors: $ python setup.py build running build running build_ext building 'cx_Oracle' extension creating build creating build/temp.linux-x86_64-2.6-11g gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/jadams/cx_Oracle/instantclient_11_2/sdk/include -I/usr/include/python2.6 -c cx_Oracle.c -o build/temp.linux-x86_64-2.6-11g/cx_Oracle.o -DBUILD_VERSION=5.1 cx_Oracle.c:6:20: error: Python.h: No such file or directory cx_Oracle.c:7:22: error: datetime.h: No such file or directory cx_Oracle.c:8:26: error: structmember.h: No such file or directory In file included from cx_Oracle.c:137: Buffer.c:13: error: expected specifier-qualifier-list before âPyObjectâ Buffer.c: In function âcxBuffer_Initâ: Buffer.c:28: error: âudt_Bufferâ has no member named âobjâ Buffer.c: In function âcxBuffer_Copyâ: Buffer.c:44: warning: implicit declaration of function âPy_XINCREFâ Buffer.c:44: error: âudt_Bufferâ has no member named âobjâ .....and thousands more lines of errors..... Is there a YUM package for cx_Oracle? If so how can I locate/install it? (sorry for a maybe dumb question -- my Linux sysadmin skills are feeble) Any suggestions will be greatly appreciated, thanks in advance for your help! --James |
From: Christopher J. <chr...@or...> - 2013-03-22 21:08:12
|
On 03/21/2013 02:49 PM, David Stanek wrote: > On Thu, Mar 21, 2013 at 5:36 PM, Christopher Jones <chr...@or... <mailto:chr...@or...>> wrote: > > Try an explicit session pool: > > > Thanks! It looks like this does the trick. That's good news. I blogged about it at https://blogs.oracle.com/opal/entry/python_cx_oracle_and_oracle Chris -- chr...@or... http://twitter.com/ghrd Newly updated, free PHP & Oracle book: http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html |