Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 01DD19FB65F for ; Wed, 18 Jul 2007 01:46:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 64535-09 for ; Wed, 18 Jul 2007 01:46:44 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.248]) by postgresql.org (Postfix) with ESMTP id 1F36A9FA225 for ; Wed, 18 Jul 2007 01:46:44 -0300 (ADT) Received: by an-out-0708.google.com with SMTP id c36so13645ana for ; Tue, 17 Jul 2007 21:46:44 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=by/M/5IPmpGMQSf6ppj1S95BE2NHP4u3dtgQicpJmg4Th/VIPQbokTWJOCYdhxhY1dZkBHdcJ4cd5x99DCJKfcwlDkSgAL54LFDfRC9G+7hh6P4k99o8PKN06lb9Pq+NPuN8h6fEVcq7QC4uSAdwtIFZwZN3NZp/wSDNj/D9Vv8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=g6s6E7Izf8jKEM2koe0hQPPbK6j+SvIEHs8Ck+GwQxWo7uE7YhfsdRgEL7S9U0KfVh2ZjjEHg0H5DzwYobwd9BxmCa2IqZmlFKHkJvOytadV40BrVKnjA68Sndq0hw+OHMJCVSVP91QNxt1mEGjbcR6f+B90WigxzXN2ZHwbUgA= Received: by 10.100.191.5 with SMTP id o5mr740764anf.1184734004331; Tue, 17 Jul 2007 21:46:44 -0700 (PDT) Received: by 10.100.33.20 with HTTP; Tue, 17 Jul 2007 21:46:44 -0700 (PDT) Message-ID: Date: Tue, 17 Jul 2007 23:46:44 -0500 From: "=?UTF-8?Q?Rodrigo_De_Le=C3=B3n?=" To: "Norm Garand" Subject: Re: Inserting an IF statement in the middle of a SELECT in pl/pgSQL code Cc: pgsql-sql@postgresql.org In-Reply-To: <52149.39195.qm@web88311.mail.re4.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <52149.39195.qm@web88311.mail.re4.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/107 X-Sequence-Number: 28842 On 7/17/07, Norm Garand 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)