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: InitCap Software or script?

RE: InitCap Software or script?

From: Thomas, John <John.Thomas_at_telesenskscl.com>
Date: Wed, 10 Apr 2002 07:23:37 -0800
Message-ID: <F001.004408D5.20020410072337@fatcity.com>


Here's one way:

SQL> DEF val = "Donald"
SQL>
SQL> SELECT
  2            CASE WHEN LOWER(SUBSTR('&&val', 1, 2)) = 'mc' THEN 'Mc' ||
INITCAP(SUBSTR('&&val', 3))
  3                 WHEN LOWER(SUBSTR('&&val', 1, 3)) = 'mac' THEN 'Mac' ||
INITCAP(SUBSTR('&&val', 4))
  4                 ELSE INITCAP('&&val' ) END
  5 FROM dual
  6 /  

CASEWH



Donald  

SQL> DEF val = "McDonald"
SQL> /   CASEWHEN



McDonald  

SQL> DEF val = "MacDonald"
SQL> /   CASEWHENL



MacDonald  

> Cheers,
>
> John Thomas

-----Original Message-----
Sent: 10 April 2002 15:38
To: Multiple recipients of list ORACLE-L

I have a fellow DBA that has to do some data cleansing. He is looking for some software that can properly init cap a last name, like McDonald. Obviously, Oracle has an initcap function...

SQL> select initcap('GRABOWY') from dual;

INITCAP



Grabowy

Elapsed: 00:00:00.50
SQL> select initcap('MCDONALD') from dual;

INITCAP(



Mcdonald

Elapsed: 00:00:00.10
SQL> But it does not recognize "special" names like McDonald, so I was wondering if someone else has encountered this, and what their solution was??

TIA!!!

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Grabowy, Chris
  INET: cgrabowy_at_fcg.com

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).


**********************************************************************
Legal Disclaimer : This e-mail is for the intended recipient only. 
If an addressing or transmission error has misdirected this e-mail, 
please notify the sender by replying to this e-mail.  If you are not 
the intended recipient you must not use, disclose, distribute, copy,
print or rely on this e-mail.  The opinions expressed in this message
are those of the sender and not those of TelesensKSCL.

This footnote also confirms that this e-mail has been swept by 
MIMEsweeper for the presence of computer viruses.

Please note that TelesensKSCL monitors both incoming and
outgoing emails in accordance with our email policy.
**********************************************************************

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Thomas, John
  INET: John.Thomas_at_telesenskscl.com

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 Wed Apr 10 2002 - 10:23:37 CDT

Original text of this message

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