Solved

Split value based on character

Posted on 2011-02-17
2
533 Views
Last Modified: 2012-05-11
I'm trying to write a SQL script without create a new column to storage footnote. How can I separate data based on letter a, b, c, and d:

columnA  footnote
0.0002a      a
0.3b            b
000c           c
0.333      
0.343d        d
....

I know this script is incorrect, but you get an idea what I'm trying to do:

Select columnA, rtrim(columnA, 1) as footnote from table

Thanks,
0
Comment
Question by:maheflin25
2 Comments
 
LVL 73

Accepted Solution

by:
sdstuber earned 400 total points
ID: 34918249
try this...

regexp_substr(columnA,'[a-d]$')
0
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 100 total points
ID: 34918266
If you have more than letter or string of letters:

select regexp_substr(columnA,'[a-z]+$') from tab1;
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now