Use default value when no rows returns.
From: Beto <andredigi_at_hotmail.com>
Date: Thu, 23 Oct 2008 03:55:06 -0700 (PDT)
Message-ID: <8d658a9f-c11a-4d1c-b441-8650c58bb514@u46g2000hsc.googlegroups.com>
-1
Date: Thu, 23 Oct 2008 03:55:06 -0700 (PDT)
Message-ID: <8d658a9f-c11a-4d1c-b441-8650c58bb514@u46g2000hsc.googlegroups.com>
Hi All,
I need a help.
I have a query inside one shell script and i'm wondering how to return any default value when no rows return from my query.
For example:
printf "%s\n" "set pages 0" "set feed off"
"SELECT value FROM tableA WHERE date > to_date('01/11/2010','dd/mm/
yyyy') ;"
| sqlplus -s user/password | while read nr3
from my query "SELECT value FROM tableA WHERE date > to_date('01/11/2010','dd/mm/yyyy') ;" no value is returned and when no row return i would like to assign a default value like '-1 ' for example.
value
-1
Thanks in advance!! Received on Thu Oct 23 2008 - 05:55:06 CDT