Want to generate the equivalent of a GUID or UUID in DB2? The closest you’ll get is with GENERATE_UNIQUE(), but beware that you need to do some conversion on it as the value is “BIT DATA” and not character data. To put the value into a typical CHAR or VARCHAR field (like you would with a java UUID), use this…
select TRIM(CHAR(HEX(GENERATE_UNIQUE()))) from sysibm.sysdummy1;
I should probably also mention that there is the IDENTITY and SEQUENCE, but the GENERATE_UNIQUE() function is the closest you’ll get to a GUID or UUID.Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂
You or someone you know looking to buy or sell?