Subject Re: [firebird-support] UUID (octets) to something readable
Author Ivan Prenosil
> Is there some native way in FB 2.1 to convert from a UUID or any octet
> field to a human readable or url friendly format (i.e. hexadecimal or
> base64)?

No. But you can
- format value on client, or
- write UDF to do it, or
- convert using PSQL code, something like

EXECUTE BLOCK RETURNS(UUID VARCHAR(32)) AS
DECLARE VARIABLE U CHAR(16) CHARACTER SET OCTETS;
DECLARE VARIABLE C INTEGER;
DECLARE VARIABLE I INTEGER;
BEGIN
U = GEN_UUID();
UUID = '';
I = 1;
WHILE (I <= OCTET_LENGTH(U)) DO BEGIN
C = ASCII_VAL(SUBSTRING(U FROM I FOR 1));
UUID = UUID || SUBSTRING('0123456789ABCDEF' FROM BIN_SHR(C, 4)+1 FOR 1)
|| SUBSTRING('0123456789ABCDEF' FROM BIN_AND(C, 15)+1 FOR 1);
I = I + 1;
END
SUSPEND;
END

Ivan
http://www.volny.cz/iprenosil/interbase/