RE: Always return at least one value

  • From: Stephen.Lee@xxxxxxxx
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Fri, 19 Mar 2004 11:41:48 -0600

Cool!

But now I think Oracle needs a WHEN_NO_ROWS or GIMME_SOMETHING function.

In case your are wondering: This has to run as a Cartesian product of four
subqueries (which are the subject of my question) to give every combination
of output with four input characters.  For example: If input #1 is 'A', then
the output might be 'C','D','X'.  If input #2 is 'C', the output might be
'Y','Z', etc.  But if one of the input characters has no output equivalent,
then we still must find combinations of the remaining characters with a '-'
in place of the unmatched character.

> -----Original Message-----
> SQL> select decode(z.table_name, chr(255), 'Nix', 
> z.table_name) table_name
>   2  from (select table_name,
>   3               rownum rn
>   4        from user_tables
>   5        where table_name like 'O%'
>   6        union all
>   7        select chr(255), 99999999999999999999
>   8        from dual) z
>   9  where decode(rownum, 1, z.rn, rownum) = z.rn
>  10  /
> 
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: