Search Postgresql Archives

Re: *****SPAM***** Re: if-clause to an exiting statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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,
                 now() AS _ts
            FROM events a
                WHERE
a.eventuei='uei.opennms.org/comns/backup-success-trap' AND
                (eventcreatetime > now() - interval '10 minutes')

Thanks !!!!
Kobi

On Tue, 2010-12-07 at 09:51 -0700, Scott Ribe wrote:
> 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 to happen? Set the row count to 1, so that the application then tries to access the 1st row of 0???
> 
> If you need some dummy row returned even in the case where there's no match, then you'll have to construct your query that way...
> 
> -- 
> Scott Ribe
> scott_ribe@xxxxxxxxxxxxxxxx
> http://www.elevated-dev.com/
> (303) 722-0567 voice
> 
> 
> 
> 
> 

-- 
Kobi Biton
Com N S Ltd.

Mobile: +972 (54) 8017668


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux