Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Always return at least one value

RE: Always return at least one value

From: <Stephen.Lee_at_DTAG.Com>
Date: Fri, 19 Mar 2004 11:41:48 -0600
Message-ID: <D6339830FC73944E889CC3CEADDB205B0790929F@bu-dtagpo1.tracs.com>

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_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Fri Mar 19 2004 - 11:38:19 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US