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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Null select

Re: Null select

From: Kenneth C Stahl <BlueSax_at_Unforgettable.com>
Date: 2000/05/12
Message-ID: <391C3D4F.EAC7C941@Unforgettable.com>#1/1

Kram wrote:
>
> I am performing the select statement which includes formatting a credit card
> number with "-". However, the problem is if the record returns a null the
> "-" the statement still returns "---" is there a better way to perform this?
>
> select crcname,
> crcexp,
> rpad(substr(crcardno,1,4) || '-' || substr(crcardno,5,4) || '-' ||
> substr(crcardno,9,4) || '-' || substr(crcardno,13,4),25,' ')
> from crcard

select crcname,

       crcexp,
       rpad(substr(crcardno,1,4) || decode(crcardno,null,null,'-') ||
substr(crcardno,5,4) || decode(crcardno,null,null,'-') ||
       substr(crcardno,9,4) || decode(crcardno,null,null,'-') ||
substr(crcardno,13,4),25,' ')
from crcard Received on Fri May 12 2000 - 00:00:00 CDT

Original text of this message

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