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.
|
|
|
|
| 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 |
Send this thread to your friend |
|
|
|
|
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 Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Vinoth Kumar | 357 |
| Gopu Gopi | 340 |
| Gitesh Trivedi | 322 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|