Differentiate Between Zero-Length String and NULL Column Values

Поиск
Список
Период
Сортировка
Искать
От
Phillip Smith
Тема
Differentiate Between Zero-Length String and NULL Column Values
Дата
Msg-id
016d01c74430$043b1b90$9b0014ac@wbaus090
Список
Дерево обсуждения
Differentiate Between Zero-Length String and NULL Column Values "Phillip Smith" <phillip.smith@weatherbeeta.com.au>
Re: Differentiate Between Zero-Length String and NULL Column Values Michael Fuhr <mike@fuhr.org>
Re: Differentiate Between Zero-Length String and NULL Column Values Andrew Sullivan <ajs@crankycanuck.ca>
Re: Differentiate Between Zero-Length String and NULLColumn Values "Bart Degryse" <Bart.Degryse@indicator.be>
Re: Differentiate Between Zero-Length String and NULLColumn Values Andrew Sullivan <ajs@crankycanuck.ca>
Re: Differentiate Between Zero-Length String and NULLColumn Values "D'Arcy J.M. Cain" <darcy@druid.net>
Re: Differentiate Between Zero-Length String and NULLColumn Values Andrew Sullivan <ajs@crankycanuck.ca>
Re: Differentiate Between Zero-Length String and NULLColumn Values Geoff Tolley <geoff@polimetrix.com>
Re: Differentiate Between Zero-Length String and NULLColumn Values Jamie A Lawrence <jal@clueinc.net>
Re: Differentiate Between Zero-Length String and NULLColumn Values Jan Wieck <JanWieck@Yahoo.com>
Re: Differentiate Between Zero-Length String and NULLColumn Values Peter Eisentraut <peter_e@gmx.net>
Re: Differentiate Between Zero-Length String and NULLColumn Values BillR <iambill@williamrosmus.com>
Re: Differentiate Between Zero-Length String and NULLColumn Values Andrew Sullivan <ajs@crankycanuck.ca>
Re: Differentiate Between Zero-Length String and NULLColumn Values Herouth Maoz <herouth@tippcom.co.il>
Re: Differentiate Between Zero-Length String and NULLColumn Values Tomas Vondra <tv@fuzzy.cz>
Hi All,

Small problem with 8.2.1, I have a temp table of basic stock details:CREATE TEMP TABLE tmpstk(  code varchar(6),  description varchar(38),  grp varchar(4),  brand text,  style text,  supplier varchar(6),  supplier_code text,  wholesale numeric(10,2),  retail numeric(10,2),  ean varchar(13))WITHOUT OIDS;

This table is populated using a COPY query – works OK. If I try the
following query:SELECT * FROM tmpstk
I get what I expect, almost 8000 rows including rows similar to the
following:
"401514","EQUINADE_SHOWSILK_SHAMPOO_5L","3209","EQUINADE","SHAMPOO","EQUEST"
,"401514","0.00","0.00","0.00","0.00","10.00","9329028056594"
"401600","A/DRESS_SHAMPOO_TEA_TREE_OIL_500ML","3208","AUSTRALIAN_DRESSAGE","
SHAMPOO","EQUEST","401600","0.00","0.00","0.00","0.00","10.00",""

The second row (401600) is what I’m interested in for this particular
problem. The problem is when I try and add a WHERE clause:SELECT * FROM tmpstk WHERE ean = '';SELECT * FROM tmpstk WHERE TRIM(ean) = '';SELECT * FROM tmpstk WHERE ean = NULL;
None of the above queries return any rows.

What am I doing wrong? It should return the 401600 row above, along with
several hundred other rows. I have attached the bash script that actually
does this processing.

Help is much appreciated.
Cheers,
-p


Phillip Smith
IT Coordinator
Weatherbeeta P/L
AUSTRALIA
 
E. phillip.smith@NO-SPAM.weatherbeeta.com.au



*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee.  If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments

В списке pgsql-sql по дате отправления
От: Adrian Klaver
Дата:
От: Michael Fuhr
Дата:
FAQ