Re: [GENERAL] if-clause to an exiting statement

2010-12-17 Thread Rob Sargent
Jasen Betts wrote: On 2010-12-07, Kobi Biton 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

Re: [GENERAL] if-clause to an exiting statement

2010-12-16 Thread Jasen Betts
On 2010-12-07, Kobi Biton 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

Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread Kobi Biton
Adrian hi, Thanks for the reply can you please show me how to incorporate the below into my below statement ? SELECT a.eventuei AS _eventuei, a.nodeid AS _nodeid, a.ipaddr AS _ipaddr, now() AS _ts FROM events a

Re: *****SPAM***** Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread Kobi Biton
Scott hi, I know it does not sound logic however I do need to set the row count to 1 in case row count returns 0 , can you show how to add that case clause and dummy line in my below code ? SELECT a.eventuei AS _eventuei, a.nodeid AS _nodeid, a.ipaddr AS _ipaddr,

Re: *****SPAM***** Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread Kobi Biton
I know it does not make sens "application bug" however consider the following scenarion , looking at the Statement I sent I would like to check if over the last 10 minutes a certain type of event was logged and if NOT (row-count=0) then I would like to trigger and action. hope it makes more sense.

Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread Adrian Klaver
On 12/07/2010 08:04 AM, Kobi Biton wrote: Adrian hi, Thanks for the reply can you please show me how to incorporate the below into my below statement ? SELECT a.eventuei AS _eventuei, a.nodeid AS _nodeid, a.ipaddr AS _ipaddr, now()

Re: *****SPAM***** Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread Scott Ribe
On Dec 7, 2010, at 9:58 AM, Kobi Biton wrote: > > I know it does not sound logic however I do need to set the row count > to 1 in case row count returns 0 Perhaps I didn't make myself clear: you can't do that. The only thing you can do is make sure your query returns a row, and in the case where

Re: *****SPAM***** Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread Scott Ribe
On Dec 7, 2010, at 4:58 AM, kobi.biton wrote: > > hi thanks for the reply I did look at the CASE statement however cannot seem > to alter the returned row-count ... Well, yeah. The row count is the count of rows returned. If there are no rows matched by the query, then what exactly do you expect

Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread Adrian Klaver
On Tuesday 07 December 2010 3:58:46 am kobi.biton wrote: > hi thanks for the reply I did look at the CASE statement however cannot > seem to alter the returned row-count ... > > CASE WHEN (@@ROW-COUNT = 0) THEN > > [what do I write here?] @@ROW-COUNT = 1? > > END > -- > View this message

Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread kobi.biton
hi thanks for the reply I did look at the CASE statement however cannot seem to alter the returned row-count ... CASE WHEN (@@ROW-COUNT = 0) THEN [what do I write here?] @@ROW-COUNT = 1? END -- View this message in context: http://postgresql.1045698.n5.nabble.com/if-clause-to-an-ex

Re: [GENERAL] if-clause to an exiting statement

2010-12-07 Thread Grzegorz Jaƛkiewicz
lookup CASE WHEN END in docs. -- GJ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] if-clause to an exiting statement

2010-12-07 Thread Kobi Biton
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. My question is : Can I