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: Sql question - please reply fast

Re: Sql question - please reply fast

From: Michal Zaschke <zaschke_at_suas.cz>
Date: Thu, 15 Nov 2001 00:40:08 -0800
Message-ID: <F001.003C574B.20011114234018@fatcity.com>

create table AAA (NAME varchar2(30));

insert into AAA values ('Pelle T3333');
insert into AAA values ('Kalle S1000');
insert into AAA values ('Info missing');
insert into AAA values ('Pelle Svensson T33333');
insert into AAA values ('Bad info');

select decode(name, 'Info missing',NAME,'Bad info',NAME,substr(NAME, 1, instr(NAME, ' ', -1)-1)) NAME from AAA;

HTH,
       Mike

Roland.Skoldblom_at_ica.se pí&scaron;e:
>
> Hej
>
> Would like to have som help with this. Please give me an example of sql statement.
>
> I have field1.
>
> Pelle T3333
> Kalle S1000
> Info missing
> Pelle Svensson T33333
> Bad info
>
> and want this result after the selectstatement.
>
> Pelle
> Kalle
> Info missing
> Pelle Svensson
> Bad info
>
> which means that I dont want to have the last word in this field except
> 'Info missing' and 'Bad info'. These two should remain unchanged, but all other
>should not have the last word .
>
> Thanksin advance
>
> Roland S
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author:
> INET: Roland.Skoldblom_at_ica.se
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

-- 
 Ing. Michal Zaschke           
   DB Administrator             
Sokolovska uhelna, a.s.
phone: +420-168-465417
e-mail: zaschke_at_suas.cz
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Michal Zaschke
  INET: zaschke_at_suas.cz

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Nov 15 2001 - 02:40:08 CST

Original text of this message

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