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!

How to split values from 1 column into 2 columns?

Tutti FruttiDec 29 2018 — edited Dec 29 2018

Hi,

Happy Holidays to all!

I am trying to separate the values from a single column into two columns, where COL_2 will have the remaining values after the third decimal. How can I improve my script below in order to get COL_2 desired result?

This is my script, COL_1 is good but COL_2 is giving me the last character only.

SELECT COLUMN_DATA

NVL(SUBSTR(COLUMN_DATA, 0, INSTR(COLUMN_DATA,'.')+4), COLUMN_DATA) AS COL_1,

NVL(SUBSTR(COLUMN_DATA, -1, INSTR(COLUMN_DATA,'.')-1), COLUMN_DATA) AS COL_2

FROM TABLE;

Database version: 11.2.0.1.0

Section.png

Thanks,

TF

This post has been answered by Frank Kulash on Dec 29 2018
Jump to Answer
Comments
Post Details
Added on Dec 29 2018
7 comments
3,567 views