Re: [GENERAL] coalesce function

2013-06-21 Thread David Johnston
Chris Angelico wrote > On Fri, Jun 21, 2013 at 7:36 AM, David Johnston < > polobo@ > > wrote: >> SELECT input >> FROM ( SELECT unnest($1) AS input ) src >> WHERE input IS NOT NULL AND input <> '' >> LIMIT 1; > > Does this guarantee the order of the results returne

Re: [GENERAL] coalesce function

2013-06-20 Thread Chris Angelico
On Fri, Jun 21, 2013 at 7:36 AM, David Johnston wrote: > SELECT input > FROM ( SELECT unnest($1) AS input ) src > WHERE input IS NOT NULL AND input <> '' > LIMIT 1; Does this guarantee the order of the results returned? Using LIMIT without ORDER BY is something I'v

Re: [GENERAL] coalesce function

2013-06-20 Thread David Johnston
itishree sukla wrote > Hi All, > > I am using coalesce(firstname,lastname), to get the result if first name > is > 'NULL' it will give me lastname or either way. I am having data like > instead of NULL, blank null ( i mean something like '' ) for which > coalesce is not working, is there any work

Re: [GENERAL] coalesce function

2013-06-20 Thread Serge Fonville
Hi, http://www.postgresql.org/docs/9.1/static/functions-conditional.html describes NULLIF, when combined with COALESCE it should answer your request. HTH Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Microsoft! They need to add TRUNCATE PARTITION in

Re: [GENERAL] coalesce function

2013-06-20 Thread Leif Biberg Kristensen
Torsdag 20. juni 2013 21.45.02 skrev itishree sukla: > Hi All, > > I am using coalesce(firstname,lastname), to get the result if first name is > 'NULL' it will give me lastname or either way. I am having data like > instead of NULL, blank null ( i mean something like '' ) for which > coalesce is

[GENERAL] coalesce function

2013-06-20 Thread itishree sukla
Hi All, I am using coalesce(firstname,lastname), to get the result if first name is 'NULL' it will give me lastname or either way. I am having data like instead of NULL, blank null ( i mean something like '' ) for which coalesce is not working, is there any workaround or other function available

Re: [GENERAL] COALESCE function

2006-12-30 Thread mike
Based on the below each row could end up returning a different data type compared to a previous row for that column. SELECT COALESCE( CAST(f.number as varchar(100)) , f.name) FROM Whatever f.name is set to in terms of the max length of varchar, if any, is what f.number should be cast to. mik

[GENERAL] COALESCE function

2006-12-30 Thread Kevin Hunter
Hello All, Attempting to select two different column types with COALESCE returns this error: ERROR: COALESCE types smallint and character varying cannot be matched Attempting the same thing with a CASE statement returns a similar error: ERROR: CASE types smallint and character varying cannot