Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> need solution

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: need solution
 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

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Vinoth Kumar357
  Gopu Gopi340
  Gitesh Trivedi322
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software