?
Solved

Split value based on character

Posted on 2011-02-17
2
Medium Priority
?
537 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 74

Accepted Solution

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

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

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 400 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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses

777 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