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 >> SOS - Help wanted

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: SOS - Help wanted
 Jolly  Posted: Jul 24, 2007 07:51:57 PM

 Total Post: 24
 Joined: Mar, 2007






 Hi All,

I need to get help on the following :

I have different type of names of varying length.
Ex:- ABBOTSFORD_GD003, AIRD_PF002 etc

Now I want to substr the names depending upon the length, I want it as - ABBOTD003, AIRDF002 etc.

Does nobody got any idea how to do this. Your help will be highly appreciated.

Thanks and regards
Jolly

 chinna
Posted: Jul 25, 2007 03:28:23 AM  

 Total Post: 28
 Joined: May, 2007






 
Hi Jolly,
My query will reach you or not,but i am trying to solve that problem.

SELECT SUBSTR(INPUTVALUE,1,INSTR(INPUTVALUE,'_')-1)||
SUBSTR(INPUTVALUE,INSTR(INPUTVALUE,'_')+2)
FROM TABLENAME;

EXAMPLE:
SELECT SUBSTR('ABBOTSFORD_GD003',1,INSTR('ABBOTSFORD_GD003','_')-1)||
SUBSTR('ABBOTSFORD_GD003',INSTR('ABBOTSFORD_GD003','_')+2)
FROM DUAL;


O/P
ABBOTSFORDD003, AIRDF002

Please send me feedback on this query,so thst i can make any changes.

regards
srawan
byeeeeeee





 chinna
Posted: Jul 25, 2007 05:27:20 AM  

 Total Post: 28
 Joined: May, 2007






 
hi,
don't consider the above one.

consider this one example,

SELECT SUBSTR('ABBOTSFORD_GD003',1,INSTR('ABBOTSFORD_GD003','_')-1)||
SUBSTR('ABBOTSFORD_GD003',INSTR('ABBOTSFORD_GD003','_')+2),
SUBSTR('AIRD_PFOO2',1,INSTR('AIRD_PFOO2'3','_')-1)||
SUBSTR('AIRD_PFOO2',INSTR('AIRD_PFOO2','_')+2)
FROM DUAL;
O/P :
ABBOTSFORDD003 AIRDFOO2

bye

 Jolly
Posted: Jul 25, 2007 06:50:21 PM  

 Total Post: 24
 Joined: Mar, 2007






 
Hi,

Thanks it worked perfectly. Thanks for your help. Now I will modify accordingly to suit my need.

Thanks and regards
Jolly

 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