2

I have a column with values as,

CompanyDetails

Id=18, company=3,org=[objectId=18, objectName=Library], parentOrg=null 
Id=10009,company=company=[companyId=3, companyName=CONE],org=[objectId=18, objectName=Library], parentOrg=[objectId=10001, objectName=Cyb 1]
Id=10008, company=3,org=[objectId=10005, objectName=Cyb 5], parentOrg=[objectId=10004, objectName=Cyb 4]
Id=10007, company=3,org=[objectId=10004, objectName=Cyb 4], parentOrg=[objectId=10003, objectName=Cyb 3], 

The data type of the above column is 'VARCHAR2'.

Now I want to get value of all object Ids in the above column something like this.

OrgId
----
18
1004
1005
2
  • To clarify, is org a column in the row of a table called CompanyDetails, or does each line represent a single value for the field CompanyDetails? Commented Aug 7, 2013 at 16:31
  • org is one of the column names in the table CompanyDetails Commented Aug 7, 2013 at 16:46

1 Answer 1

3

If you are sure that object id is the 3rd value, you can use regex_substr to do this.

SELECT REGEXP_SUBSTR (column, '\d+', 1, 3)
  FROM table;

You can also use regexp_replace, in case it is not the 3rd value always.

SELECT REGEXP_REPLACE (column, '(org=\[objectId=)(\d+)|(.)', '\2')
  FROM table;
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you verry much, it helped a lot to me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.