Please Visit Our New Website for Further Communication

Amazon

30 Jan 2013

SQL Query to Fetch Numeric Data from String value in Oracle

Query to fetch Numeric Data from String value in an Oracle Table:
Step 1: Create a Table “Test” as shown below:
CREATE TABLE TEST (A VARCHAR2(30));
Step 2: Insert string data value into “TEST” Table.
INSERT INTO TEST VALUES ('1DA2SDJD+4567@@##HGSD89HH0');
Step 3: Select the “TEST” Table.
SELECT * FROM TEST;
A
1DA2SDJD+4567@@##HGSD89HH0


Step 4: Run the below query to fetch “Numeric” value from String data.
select regexp_replace(A,'[^0-9]') as a FROM TEST3;
Output:
A
124567890



No comments:

Post a Comment