Reputation: 41
I am wanting to parse a string within SQL, However, I am not sure how to go about doing so.
Here is my code:
SELECT distinct sku, A_CLUSTER_DESC
FROM TOOL_SAS_DATA
WHERE sku in (1099895,
1099896,
1000960,
1000960,
1000898
);
My output is:
|| sku || A_Cluster_desc ||
1 ||1099895|| 'GG SAS AP_1234 A'||
2 ||1099896|| 'GG SAS AP_1113 B'||
etc.
I am wanting to just output under A_Cluster_desc
for it to say AP_1234
or AP_1113
and just excluding everything else around it.
EDIT:
Sorry if it wasn't more clear, I am wanting to just output AP_1234 or AP_####
Upvotes: 0
Views: 70
Reputation: 65408
Just for A_CLUSTER_DESC
part, use :
select regexp_substr(A_CLUSTER_DESC, '(.*?GG SAS )(.*?) ',1,1,'',2) from TOOL_SAS_DATA;
Upvotes: 2