Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Split string into two columns by dash

CrackerJackApr 16 2013 — edited Apr 17 2013
Hi All,

I have got thisworking

decode(SUBSTR(ADDR2_ATTR_1,1,INSTR(ADDR2_ATTR_1,'-')-1),'9999',NULL,(SUBSTR(ADDR2_ATTR_1, 1, INSTR(ADDR2_ATTR_1,'-')-1))),

decode(SUBSTR(ADDR2_ATTR_1, INSTR(ADDR2_ATTR_1,'-' )+1),'9999',NULL,(SUBSTR(ADDR2_ATTR_1, INSTR(ADDR2_ATTR_1,'-')+1)))

but results came a little different.

It came up as

Col1 for 8 - 10 have came up beauiful ...but however the data at Col2 should be in Co1 and have transferred to Col2

Col1 Col2
<null> 10
<null> 33
8 10

Any guidance is much appreciated.
This post has been answered by Manik on Apr 17 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2013
Added on Apr 16 2013
8 comments
933 views