Page 1 of 1

Oracle GUID creation (why so complicated?)

Posted: Sun Sep 29, 2024 10:26 am
by hudatolah

Code: Select all

--SELECT SUBSTR( (SELECT REGEXP_REPLACE(SYS_GUID(), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5') MSSQL_GUID  FROM DUAL), 1,15) FROM DUAL

SELECT SUBSTR( (SELECT REGEXP_REPLACE(SYS_GUID(), '(.{8})(.{4})(.{4})(.{4})', '\4') MSSQL_GUID  FROM DUAL), 5,20) FROM DUAL

SELECT SUBSTR( (
SELECT REGEXP_REPLACE(SYS_GUID(), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5') MSSQL_GUID  FROM DUAL
), 1,15) FROM DUAL


SELECT CAST (SYS_GUID() AS VARCHAR(32)) FROM DUAL