Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


Universally Unique Identifier - UUID


The pre-defined schema BUILTIN contains the following user-defined type to store unique identifier data:

Type
SQL type
Description

builtin.uuid

BINARY(16)


The following routines belong to the uuid user-defined type:

Routine
Routine type
Description

BUILTIN.UUID_NEW()

Function
Generates a new uuid value, which with very high probability is globally unique.

BUILTIN.UUID_FROM_
TEXT(HEXSTRING)

Function
Converts a hexadecimal string to an uuid value.
The HEXSTRING argument should follow the standard format hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh, where each h is a hexadecimal value represented by using the characters 0-9 and a-f.

AS_TEXT

Instance method
Converts a uuid value to a character representation, using the UUID standard format.

Example

Create a table and insert a few values:

 create table uuid (uuid builtin.uuid);
 
 insert into uuid values (builtin.uuid_new());
 insert into uuid values (builtin.uuid_new());
 
 select uuid.as_text() from uuid;
 
 ====================================
 039f01f0-a635-11e8-9f4c-aa0004007a04
 04494bb0-a635-11e8-9f4c-aa0004007a04
 

It is also possible to insert uuid values explicitly, either by using a binary constant or converting a character string using the function bultin.uuid_from_text.

 insert into uuid values (x'62E4BD10A63711E8A174AA0004007A04');
 insert into uuid values
    (builtin.from_text('85dc2790-a637-11e8-a174-aa0004007a04'));

More information about uuid can be found at https://en.wikipedia.org/wiki/Universally_unique_identifier


Mimer
Mimer Information Technology AB
Phone: +46 18 780 92 00
info@mimer.com
Mimer SQL Documentation TOC PREV NEXT INDEX