Solved

Split value based on character

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

Accepted Solution

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

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Loading flat file data in tables 2 64
Setting variables in a stored procedure 5 51
Union & Crosstab qrys 101! 6 58
Oracle performance tuning 2 30
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

726 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