SYS_GUID

2024-03-05 01:54:27  Updated

Purpose

SYS_GUID() generates and returns a globally unique ID that comprises 16 bytes.

Syntax

SYS_GUID()

Return type

The hexadecimal representation of the 32-character value of the global unique ID is returned.

Examples

Create a table named tbl1 and insert three data rows with unique IDs into the table.

obclient> CREATE TABLE tbl1(col1 INT,col2 RAW(16));
Query OK, 0 rows affected

obclient> INSERT INTO tbl1 VALUES(1,SYS_GUID()),(2,SYS_GUID()),(3,SYS_GUID());
Query OK, 3 rows affected
Records: 3  Duplicates: 0  Warnings: 0

obclient> SELECT * FROM tbl1;
+------+----------------------------------+
| COL1 | COL2                             |
+------+----------------------------------+
|    1 | 442E52AC599411EC8C99B6945CA6C7B0 |
|    2 | 442EC8D1599411EC8C99B6945CA6C7B0 |
|    3 | 442ED1F1599411EC8C99B6945CA6C7B0 |
+------+----------------------------------+
3 rows in set

Contact Us