How to delete last character Oracle

Hi I have a list of data that I was preparing to import as a 'Number'

However the data I recieved had a String at the end of the number.

Example: 350 M, 25 M

How should I delete the character 'M' and maybe any empty space.

Answers


You can combine the SUBSTR and LENGTH functions like this:

select SUBSTR('350 M', 0, LENGTH('350 M') - 1) from dual;

(or -2 if you want to remove the space also)


I think you need to get exactly the number, so I think it is easier to do with a regular expression:

select regexp_substr('350 M','^[0-9]+')
from dual;

Maybe it does not answer your current question but should solve your problem on another level.


Need Your Help

Can we swap the endianness of a data buffer, which is a fixed sized array, before mapping it to its eventual data structure?

c arrays endianness

Scenario: A remote machine (big endian) sends a message to a local machine (little endian) over RS422.

How can I see digital signature in assembly?

c# .net winforms .net-assembly

I read article about "Signing an Assembly with a Strong Name";