Home » SQL & PL/SQL » SQL & PL/SQL » First Cap
First Cap [message #9047] Wed, 15 October 2003 09:07 Go to next message
Yolinda Reddy
Messages: 2
Registered: October 2003
Junior Member
I am trying to make the first letter only a capital in a string. Currently initcap makes the first letter of every word in the string a capital. I am looking for a function that makes just the first letter of the string a capital
Re: First Cap [message #9048 is a reply to message #9047] Wed, 15 October 2003 09:12 Go to previous messageGo to next message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
quote from Yolinda Reddy:
----------------------------------------------------------------------
I am trying to make the first letter only a capital in a string. Currently initcap makes the first letter of every word in the string a capital. I am looking for a function that makes just the first letter of the string a capital

----------------------------------------------------------------------
SQL> CREATE TABLE t (x VARCHAR2(30));
  
Table created.
  
SQL> INSERT INTO t VALUES ('Test1');
SQL> INSERT INTO t VALUES ('test 2');
SQL> INSERT INTO t VALUES ('TEST NUMBER THREE');
SQL> INSERT INTO t VALUES ('4th Test');
SQL> INSERT INTO t VALUES ('test no five');
SQL> COMMIT;
  
Commit complete.
  
SQL> SELECT t.x
  2  ,      UPPER(SUBSTR(t.x,1,1))
  3         || LOWER(SUBSTR(t.x,2)) only_first_letter_capitalized
  4  FROM   t
  5  /
  
X                              ONLY_FIRST_LETTER_CAPITALIZED
------------------------------ ------------------------------
Test1                          Test1
test 2                         Test 2
TEST NUMBER THREE              Test number three
4th Test                       4th test
test no five                   Test no five
  
SQL> 
HTH,

A.
Re: First Cap [message #9055 is a reply to message #9048] Thu, 16 October 2003 00:12 Go to previous message
Yolinda Reddy
Messages: 2
Registered: October 2003
Junior Member
Thanks you. Much appreciated.

Yolinda..
Previous Topic: Select table.column(i) from table !
Next Topic: ampersand
Goto Forum:
  


Current Time: Wed Apr 24 03:33:06 CDT 2024