Re: Inserting an IF statement in the middle of a SELECT in pl/pgSQL code - Mailing list pgsql-sql

From Rodrigo De León
Subject Re: Inserting an IF statement in the middle of a SELECT in pl/pgSQL code
Date
Msg-id a55915760707172146n75dbf69btff374c054282bdbf@mail.gmail.com
Whole thread Raw
In response to Inserting an IF statement in the middle of a SELECT in pl/pgSQL code  (Norm Garand <indianlakesolutions@rogers.com>)
List pgsql-sql
On 7/17/07, Norm Garand <indianlakesolutions@rogers.com> wrote:
> /---------------
>  IF $7 IS NOT NULL THEN
>   AND f.id = pid.specific_location_cid AND f.long_desc = $7
>  END IF
> ---------------/

How about:
  AND f.ID = pid.specific_location_cid  AND f.long_desc = COALESCE ($7, f.long_desc)


pgsql-sql by date:

Previous
From: Norm Garand
Date:
Subject: Inserting an IF statement in the middle of a SELECT in pl/pgSQL code
Next
From: "Jaime Casanova"
Date:
Subject: Re: Inserting an IF statement in the middle of a SELECT in pl/pgSQL code