Casting shorter GUID as Hashtype

drumcircle
Single Node Master

For readability and performance, I have some shorter GUID-style identifiers (slugs, whatever) containing [0-9][A-F] characters

These cannot be inserted into HASHTYPE(16 BYTE) without padding.

 

 

-- failed
SELECT CAST(UCASE('550E8400E') AS HASHTYPE(16 BYTE)) STUDYID
FROM DUAL

-- success
SELECT CAST(UCASE('550E8400E00000000000000000000000') AS HASHTYPE(16 BYTE)) STUDYID
FROM DUAL

 

 

 

 

1 ACCEPTED SOLUTION

drumcircle
Single Node Master

A possible work-around:

(CAST(RPAD(PROCESSINGID,32,'0') AS HASHTYPE(16 BYTE))

View solution in original post

1 REPLY 1

drumcircle
Single Node Master

A possible work-around:

(CAST(RPAD(PROCESSINGID,32,'0') AS HASHTYPE(16 BYTE))

View solution in original post