PL/SQL (MOSC)

MOSC Banner

Converting Character Numbers to Integers

edited Dec 31, 2012 2:28AM in PL/SQL (MOSC) 10 commentsAnswered ✓
Hi,

 

Using PL/SQL, how can I convert a string containing numbers to integers? 

The count of numbers can vary and the spaces between numbers can vary.

 

For example, assume this:

 

INPUT  1:  DATA VARCHAR2(50)  (‘  10             39.78     18.6  12.34        276  55.5678   ‘)

 

OUTPUT 1:

 

INT_1   NUMBER(10,4)   (10)

INT_2  NUMBER(10,4)   (39.78)

INT_3  NUMBER(10,4)   (18.6)

INT_4  NUMBER(10,4)   (12.34)

INT_5  NUMBER(10,4)   (275)

INT_6  NUMBER(10,4)   (55.5678)

 

 

INPUT  2:  DATA VARCHAR2(50)  (‘ 2743  8  17               467.1   ‘) 

 

OUTPUT 1:

 

INT_1   NUMBER(10,4)   (2743)

INT_2  NUMBER(10,4)   (8)

INT_3  NUMBER(10,4)   (17)

INT_4  NUMBER(10,4)   (467.1)

 

Thank you!

 

 

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center