Re: [SQL] NULLS and string concatenation

2004-11-25 Thread terry
; To: Don Drake > Cc: Richard Huxton; [EMAIL PROTECTED] > Subject: Re: [SQL] NULLS and string concatenation > > > > On Fri, 19 Nov 2004, Don Drake wrote: > > > On Fri, 19 Nov 2004 17:48:34 +, Richard Huxton > <[EMAIL PROTECTED]> wrote: > > > Don Drake

Re: [SQL] NULLS and string concatenation

2004-11-23 Thread Andrew Hammond
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gregory S. Williamson wrote: | Someone on this list provided me with a rather elegant solution to this a few weeks ago: | | CREATE OR REPLACE FUNCTION text_concat_nulls_with_an_embedded_space(text, text) | RETURNS text | AS 'SELECT CASE WHEN $1 IS NULL

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Don Drake
On Fri, 19 Nov 2004 15:01:42 -0500, Tom Lane <[EMAIL PROTECTED]> wrote: > Don Drake <[EMAIL PROTECTED]> writes: > > This is still strange to me. In Oracle, the same query would not > > replace the *entire* string with a NULL, it treats the NULL as a no > > value. > > Oracle is a bit, um, standard

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Terry Lee Tucker
-Original Message- > From: Michael Fuhr [mailto:[EMAIL PROTECTED] > Sent: Fri 11/19/2004 9:53 AM > To: Don Drake; [EMAIL PROTECTED] > Cc: > Subject: Re: [SQL] NULLS and string concatenation > > On Fri, Nov 19, 2004 at 11:45:43AM -0600, Bruno Wolff III wrote: >

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Gregory S. Williamson
neatly with the NULLs in some of the columns. HTH, Greg Williamson DBA GlobeXplorer LLC -Original Message- From: Michael Fuhr [mailto:[EMAIL PROTECTED] Sent: Fri 11/19/2004 9:53 AM To: Don Drake; [EMAIL PROTECTED] Cc: Subject: Re: [SQL] NULLS and string concatenation

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Tom Lane
Don Drake <[EMAIL PROTECTED]> writes: > This is still strange to me. In Oracle, the same query would not > replace the *entire* string with a NULL, it treats the NULL as a no > value. Oracle is a bit, um, standards-challenged. They fail to make a distinction between an empty string and a NULL, b

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Stephan Szabo
On Fri, 19 Nov 2004, Don Drake wrote: > On Fri, 19 Nov 2004 17:48:34 +, Richard Huxton <[EMAIL PROTECTED]> wrote: > > Don Drake wrote: > > > select 'some text, should be null:'|| NULL > > > > > > This returns NULL and no other text. Why is that? I wasn't expecting > > > the "some text.." to

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Don Drake
On Fri, 19 Nov 2004 17:48:34 +, Richard Huxton <[EMAIL PROTECTED]> wrote: > Don Drake wrote: > > select 'some text, should be null:'|| NULL > > > > This returns NULL and no other text. Why is that? I wasn't expecting > > the "some text.." to disappear altogether. > > > > Is this a bug? > > N

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Richard Huxton
Don Drake wrote: select 'some text, should be null:'|| NULL This returns NULL and no other text. Why is that? I wasn't expecting the "some text.." to disappear altogether. Is this a bug? No. Null is "unknown" if you append unknown (null) to a piece of text, the result is unknown (null) too. If

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Michael Fuhr
On Fri, Nov 19, 2004 at 11:45:43AM -0600, Bruno Wolff III wrote: > On Fri, Nov 19, 2004 at 11:12:38 -0600, Don Drake <[EMAIL PROTECTED]> wrote: > > > > I was able to work around the problem by using COALESCE (and casting > > variables since it wants the same data types passed to it). > > This is

Re: [SQL] NULLS and string concatenation

2004-11-19 Thread Bruno Wolff III
On Fri, Nov 19, 2004 at 11:12:38 -0600, Don Drake <[EMAIL PROTECTED]> wrote: > I have a function that uses an execute statement to insert data into a > table, I do in my implementation of table partitioning. > > Anyway, I ran into trouble when NULL values were being passed in > (fields are nulla

[SQL] NULLS and string concatenation

2004-11-19 Thread Don Drake
I have a function that uses an execute statement to insert data into a table, I do in my implementation of table partitioning. Anyway, I ran into trouble when NULL values were being passed in (fields are nullable) and my insert statement turned into a big NULL. Here's an equivalent statement that