Re: if-clause to an exiting statement

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: if-clause to an exiting statement
Date: 2010-12-17 04:27:09
Message-ID: ieeoqt$j8e$2@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2010-12-07, Kobi Biton <kobi(at)comns(dot)co(dot)il> wrote:
> hi i am a newbie to sql statments , I am running postgres 8.1 with
> application called opennms version 1.8.5 due to an application bug
> queries that I execute aginst the DB which returns raw-count=0 are being
> ignored and will not process a certain trigger I need to process.

I think you want this:

ORIGINAL QUERY
union
select DUMMY ROW DATA
where
not exists ( ORIGINAL QUERY )

you need to return something to get a rowcount of 1 this is what the
dummy row data provides. the "where not exists" part blocks the dummy
row data when the main query returns something.

--
⚂⚃ 100% natural

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sandeep Srinivasa 2010-12-17 06:03:49 Re: Simple, free PG GUI/query tool wanted
Previous Message Jasen Betts 2010-12-17 03:57:41 Re: How to obtain the maximum value of a date, between 3 tables...