Re: [cx-oracle-users] varchar2 length > 250
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2006-06-22 16:40:21
|
Hmm, I tried the steps you gave and did not get the same results. The possibility, however, is that the database character set and the client character set are not the same as the ones you've used. Perhaps you can detail that information as well? If it gets too much into the unicode side of things I won't be able to be much help but others might be able to help on that front..... On 6/21/06, Kathryn Mohror <ka...@cs...> wrote: > Hi, > > I am trying to select and print strings from an Oracle 10.1.0.3.0 > database using cx_Oracle 4.1.2 and python 2.4.2. > > The problem: If I insert strings into a VARCHAR2 field with > 250 > characters, I get garbage when I retrieve them. > > Example test scenario: > > 1. in sqlplus, I execute the following commands: > create table temp_k (b varchar2(500 byte), c varchar2(500 char)); > insert into temp_k (b,c) values (rpad('b',200,'b'),rpad('c',200,'c')); > commit; > > 2. Now I use cx_oracle to retrieve the strings: > sql = "select b,c from temp_k" > ptds.cursor.execute(sql) > rets = ptds.cursor.fetchall() > print ptds.cursor.description > for b,c in rets: > towrite = "byte:%s\n"% b > f.write(towrite) > towrite = "char:%s\n"% c > f.write(towrite) > > I get the output I expect. > [('B', <type 'cx_Oracle.STRING'>, 500, 500, 0, 0, 1), ('C', <type > 'cx_Oracle.STRING'>, 500, 500, 0, 0, 1)] > byte:bbbbbbbbbbbb <snip for space> up to 200 > char:cccccccccccc <snip for space> up to 200 > > 3. Now, in sqlplus, I execute: > insert into temp_k (b,c) values (rpad('h',251,'h'),rpad('i',251,'i')); > commit; > > 4. Now, from my python script using cx_oracle, I retrieve the strings as > in step #2. Now I get garbage for the last two rows: > byte:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb > char:ccccccccccccccccccccccccccccccccccccccccccccccc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^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^ > @^@^@^@^@^@ > > If I insert more rows of length < 251 after step #4, those rows are also > returned as garbage. When I retrieve these strings via sqlplus or the QT > interface, I do not receive garbage. > > Do you know what is happening here? > > Thanks, > Kathryn > > > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |