Re: What err ???

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: What err ???
Date: 2002-06-07 14:37:08
Message-ID: 20020607143707.GA7155@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Jun 06, 2002 at 05:43:28PM -0300, Robson Martins wrote:
> What err ???
>
> SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial Like '%A%'

This looks like some other dialect of SQL, not SQL92 (nor PostGreSQL).

I _think_ you want something like:

SELECT RazaoSocial || ' - ' || COALESCE(Bairro || ' ', '') || CGCCli As
Coluna FROM Clientes WHERE RazaoSocial Like '%A%';

The differences are that the text concatenation operator is '||', not '+',
and COALESCE(), which returns it's first non-NULL parameter.

Note that this is _not_ an ADMIN question: it belongs on NOVICE.

Ross
--
Ross Reedstrom, Ph.D. reedstrm(at)rice(dot)edu
Executive Director phone: 713-348-6166
Gulf Coast Consortium for Bioinformatics fax: 713-348-6182
Rice University MS-39
Houston, TX 77005

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Masaru Sugawara 2002-06-07 15:23:30 Re: What err ???
Previous Message Joel Burton 2002-06-07 13:45:36 Re: What err ???