How do I convert a JSON Guid to Oracle Raw(16) String Data Type?
In C# Net, it is Using ToByteArray()
.
What is the equivalent in Java 8?
The following website will convert, however I need underlying code.
Goal Convert: A0824186-1E9C-AE47-95E1-1431542C2133
to string 864182A09C1E47AE95E11431542C2133
https://robobunny.com/cgi-bin/guid
- Standard:
A0824186-1E9C-AE47-95E1-1431542C2133
- Bracketed:
{A0824186-1E9C-AE47-95E1-1431542C2133}
- Oracle RAW(16) format:
864182A09C1E47AE95E11431542C2133
- Oracle hextoraw
HEXTORAW('864182A09C1E47AE95E11431542C2133')
- SQLServer using Oracle byte order:
0x864182A09C1E47AE95E11431542C2133
Net Solution Reference: Convert from Oracle's RAW(16) to .NET's GUID
Update:
Is there a way to reverse this function? ORACLE RAW in string format to Standard GUID https://mcmap.net/q/831814/-oracle-raw-in-string-format-to-standard-guid
Also, I saw some Javascript source code, maybe find a way to convert into Java
https://github.com/kanekotic/raw-guid-converter/blob/master/lib/guid-to-raw.js
const buffer = require('buffer/').Buffer,
transform = require('./helpers').transform,
patterns = require('./helpers').patterns
const convert = (raw) => {
const pattern = /([0-9A-Fa-f]{8})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{12})/i
let guid_parsed = transform(pattern, raw)
return `${guid_parsed[0]}${guid_parsed[1]}${guid_parsed[2]}${guid_parsed[3]}${guid_parsed[4]}`.toUpperCase()
}
module.exports = convert