RE: [cx-oracle-users] Nulls returned as None and not as as "empty or zero lenght string"
Brought to you by:
atuining
From: Orr, S. <so...@ri...> - 2005-05-12 13:44:25
|
If this is for display can you deal with spaces? Select nvl(null,' ') from dual Hack if you can't use spaces... Print data[0][0].strip() -----Original Message----- From: cx-...@li... = [mailto:cx-...@li...] On Behalf Of Chris = Dunscombe Sent: Wednesday, May 11, 2005 9:34 AM To: cx-...@li... Subject: Re: [cx-oracle-users] Nulls returned as None and not as as = "empty or zero lenght string" Marcos, Great idea (nvl as opposed to isnull). However cx_Oracle still returns = None e.g. cur1.execute("select nvl(subobject_name,'') from objects_big where = rownum < 5") data =3D cur1.fetchall() print data [(None,), (None,), (None,), (None,), (None,)] I thought you'd "fixed it". Thanks for the idea anyway. Chris --- Marcos S=E1nchez Provencio <ma...@bu...> wrote: > you may try to do it at oracle level >=20 > select isnull(col,'')... >=20 > it should be faster >=20 > El mi=E9, 11-05-2005 a las 07:15 -0700, Chris Dunscombe escribi=F3: > > All, > >=20 > > Is there anyway that Null values returned from a query can be an = "empty or zero length string" > > instead of None? > >=20 > > This may seem a strange request as it's easy to use type to test if = a null has been returned > as > > None. However I've a performance critical app where I need to output = "nothing" (zero length / > > empty string) if the value is null. Hence at present I have to = perform this "type test" on ALL > > columns that don't have a "Not Null" constraint in the database = which is quite an overhead > when in > > some cases I need to do it millions and sometimes billions of times. > >=20 > > Thanks, > >=20 > > Chris Dunscombe > >=20 > >=20 > > =09 > > __________________________________=20 > > Do you Yahoo!?=20 > > Read only the mail you want - Yahoo! Mail SpamGuard.=20 > > http://promotions.yahoo.com/new_mail=20 > >=20 > >=20 > > ------------------------------------------------------- > > This SF.Net email is sponsored by Oracle Space Sweepstakes > > Want to be the first software developer in space? > > Enter now for the Oracle Space Sweepstakes! > > http://ads.osdn.com/?ad_id=3D7393&alloc_id=3D16281&op=3Dclick > > _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_ids93&alloc_id=16281&op=3Dclick > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >=20 =09 Discover Yahoo!=20 Stay in touch with email, IM, photo sharing and more. Check it out!=20 http://discover.yahoo.com/stayintouch.html ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_id=3D7393&alloc_id=3D16281&op=3Dclick _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |