You could try:<br><br><FONT FACE=monospace><b>Select Initcap('MIKE LACEY') From DUAL;</font></b><br><br>You'll notice that this *nearly* does what you're asking. It capitalizes the first letter of every word in the string - rather than just the first letter of the string.<br><br>Will that do?<br><br><br> <p>Mike<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href=
Cargill's Corporate Web Site</a><br>Please don't send me email questions without posting them in Tek-Tips as well. Better yet -- Post the question in Tek-Tips and send me a note saying "Have a look at so-and-so in the thingy forum would you?"
If you really need only the first character in uppercase, try:<br><FONT FACE=monospace>select upper(substr(a.column_a, 1, 1)) ¦¦ lower (substr(a.column_a, 2))<br>from table_a a;</font>
Mike,<br><br>You could try to write your own funtion:<br><br>CREATE OR REPLACE MYFUNC (field IN CHAR)<br>RETURN CHAR<br>IS<br>BEGIN<br>DECLARE retval IN CHAR<br>FOR i IN LENGTHB(field)LOOP<br> IF i = 1 THEN<br> SELECT retval + UPPER(SUBSTR(field, i, 1)) INTO retval;<br> ELSE<br> SELECT retval + LOWER(SUBSTR(field, i, 1)) INTO retval;<br> END IF<br>LOOP;<br>RETURN retval;<br>END;<br><br>Please forgive any syntax errors. But the the you can just use your function in your query<br><br>SELECT<br>col1,<br>col2,<br>MYFUNC(col3),<br>col4<br>FROM tablename;
How about using these Oracle-provided functions: substr, upper, lower?<br>Assume you have table T1 with column C1, having 2 records:<br><br><FONT FACE=monospace><br> desc T1:<br> Name Null? Type<br> ------------------------------- -------- ----<br> C1 VARCHAR2(20)<br><br> select * from t1;<br> C1<br> --------------------<br> HI THERE THIS'a TEST<br> A<br></font><br>Then just call these 3 functions like:<br><FONT FACE=monospace><br> select c1,<br> <font color=red>upper</font>(<font color=red>substr</font>(c1,1,1)) ¦¦ <font color=red>lower</font>(<font color=red>substr</font>(c1,2)) c2<br> from t1;<br></font><br>Results:<br><FONT FACE=monospace><br> C1 C2<br> -------------------- --------------------<br> HI THERE THIS'a TEST Hi there this'a test<br> A A<br></font>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.