Solved

Split value based on character

Posted on 2011-02-17
2
532 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

757 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

21 Experts available now in Live!

Get 1:1 Help Now