Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Formatting of the GUID string.

946729Jul 16 2012 — edited Jul 16 2012
Dear gurus, I already get good help for other problem. I hope to follow guidelines this time.

In our firm we have to deal with the GUID. Now, the GUID come in 3 formats (see the other posting
of the GUID in this newsgroup). I have the several GUIDS as below

with mydata as (
select '77DB966B620D4FEBB9959D016E0BD590' as guid from dual union
select '159F25C035E845CFA95CFF4F3365B330' from dual union
select '0485FA87A2FF445E965333B6980EC176' from dual)
select guid from mydata;
Now, instead of the phrase "select guid from mydata" what I wish for is to have the
select regexp_replace(guid, xxxxxxxxxxxx, yyyyyyyyyyyy, zzzzzzzzzzz) from mydata for the following of the result.
desired result

select regexp_replace(guid, xxxxxxxxxxxx, yyyyyyyyyyyy, zzzzzzzzzzz) from mydata;

77DB966B-620D-4FEB-B995-9D016E0BD590
159F25C0-35E8-45CF-A95C-FF4F3365B330
0485FA87-A2FF-445E-965333B6980EC176

and also desired result - difference in expression

{77DB966B-620D-4FEB-B995-9D016E0BD590}
{159F25C0-35E8-45CF-A95C-FF4F3365B330}
{0485FA87-A2FF-445E-965333B6980EC176}
the needing is as the follows: put the - (hyphen charachter) at 8, 12, 16, 20 in the GUID string
and also possible choose add the bracket cureley { } at beginning end of string. I am not very strong
(still doing the learning) of the regular expressions. If any guru can help, I would be most grateful.
Jehangir.
This post has been answered by Paulie on Jul 16 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 13 2012
Added on Jul 16 2012
6 comments
10,718 views