| deal |
Posted: Mar 14, 2007 02:17:52 PM |
Total Post: 21
Joined: Nov, 2006
|
I want to display the first half of a name in Upper case
and the second half in lower case...
Can someone give me a clue about writing the query for this...
|
|
|
Rush |
| Posted: Mar 15, 2007 12:53:25 AM | |
|
Total Post: 127
Joined: Jan, 2007
|
Hello Deal,
try this
select upper(substr(ENAME,1,3))||lower(substr(ENAME,3,20)) from emp
RUPESH
|
|
|
|
|
man |
| Posted: Mar 15, 2007 01:37:25 AM | |
|
Total Post: 5
Joined: Sep, 2006
|
u can try this also...
select upper(substr(ENAME,'1',(length(ENAME)/2))) || lower(substr(ENAME,(length(ENAME)/2),length(ENAME)))
ename from emp where EMPNO = '7499'
|
|
|
|
|
Devesh |
| Posted: Mar 15, 2007 01:44:44 AM | |
|
Total Post: 29
Joined: Oct, 2005
|
Hey, Manu a little change in it is to add +1
select upper(substr(ENAME,'1',(length(ENAME)/2))) || lower(substr(ENAME,(length(ENAME)/2)+1,len
ename from emp;
|
|
|
|
|
Devesh |
| Posted: Mar 15, 2007 01:47:41 AM | |
|
Total Post: 29
Joined: Oct, 2005
|
Above query was not complete, i m reposting it.
select upper(substr(ENAME,'1',(length(ENAME)/2))) || lower(substr(ENAME,(length(ENAME)/2)+1,length(ENAME)))
ename from emp;
|
|
|
|
|
Rush |
| Posted: Mar 15, 2007 01:51:37 AM | |
|
Total Post: 127
Joined: Jan, 2007
|
This one is Fresh!!!
select UPPER(SUBSTR(ENAME,1,ROUND(LENGTH(ENAME)/2)))||LOWER(SUBSTR(ENAME,ROUND(LENGTH(ENAME)/2),LENGTH(ENAME)))
FROM EMP;
because length(ename)will give 2.5 for smith and so on for odd number so it is recomended to round that befor substr.
all are agree on this point or not???
RUPESH
|
|
|
|
|
Rush |
| Posted: Mar 15, 2007 01:57:34 AM | |
|
Total Post: 127
Joined: Jan, 2007
|
oh sorry Devesh is right!!!
select UPPER(SUBSTR(ENAME,1,ROUND(LENGTH(ENAME)/2)))||LOWER(SUBSTR(ENAME,ROUND(LENGTH(ENAME)/2)+1,LENGTH(ENAME)))
FROM EMP;
this one is perfect
RUPESH
|
|
|
|
|
deal |
| Posted: Mar 15, 2007 08:24:12 AM | |
|
Total Post: 21
Joined: Nov, 2006
|
Thanks a lot for everyone....
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |