Re: [cx-oracle-users] Named Parameters Issue - ORA-01460: unimplemented or unreasonable conversion
Brought to you by:
atuining
From: Jani T. <re...@gm...> - 2013-04-10 08:01:35
|
Ok, I do following when working with cx_Oracle: import os os.environ.update([ # Oracle takes client-side character set encoding from the environment. ('NLS_LANG', '.UTF8'), # This prevents unicode from getting mangled by getting encoded into the # potentially non-unicode database character set. ('ORA_NCHAR_LITERAL_REPLACE', 'TRUE'), ]) import cx_Oracle Above guarantees that you really are in UTF8 mode. Second environment variable one is not necessity. And AFAIK there is no other way to set them (except before running app itself) due the fact that NLS_LANG is read by OCI libs from the environment. After doing that I'll do the following: db = cx_Oracle.Connection(runenv.USERNAME, runenv.PASSWORD, runenv.TNSENTRY) c = db.cursor() c.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS' " "NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF' " "NLS_TERRITORY = 'AMERICA'") Idea is to make sure that dateformats and decimal points are consistent. For example my locale likes to use comma as a decimal separator. Which means that python 10.2f must be '10,2' when inserting to db. Painful that is. 9.4.2013 12:57, Anurag Chourasia kirjoitti: > Hi Jani. The column type is varchar2 > > Regards, > Anurag > > On 9 Apr 2013 01:14, "Jani Tiainen" <re...@gm... > <mailto:re...@gm...>> wrote: > > What is the type of the column in the table? > > There are few quirks I know of. > > 9.4.2013 1:35, Anurag Chourasia kirjoitti: > > Thanks. Will try that too and report back the findings. > > > > Regards, > > Anurag > > > > On Mon, Apr 8, 2013 at 6:00 PM, Mark Harrison <mh...@pi... > <mailto:mh...@pi...> > > <mailto:mh...@pi... <mailto:mh...@pi...>>> wrote: > > > > On 4/8/13 2:56 PM, Anurag Chourasia wrote: > > > 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. > > > > If that doesn't work can you try using a non-unicode string > such as > > > > {'TAG_NBR': 'ABC'} > > > > > > > > > ------------------------------------------------------------------------------ > > 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...> > > <mailto:cx-...@li... > <mailto: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... > <mailto:cx-...@li...> > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > > -- > Jani Tiainen > > - Well planned is half done and a half done has been sufficient > before... > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for > building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > <mailto:cx-...@li...> > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > > > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > -- Jani Tiainen - Well planned is half done and a half done has been sufficient before... |