Search code examples
mysqldatabasehsqldbuuid

SELECT UUID() in HSQLDB


Does anyone know how to retrieve UUID via HSQLDB.

For example when i try

SELECT UUID();

via MYSQL it works fine. But the same statement doesn't work with HSQLDB. The following methods achieve the corresponding purpose

VALUES (UUID())

CALL(UUID())

SELECT UUID() FROM (VALUES(0)) t;

Is there a way which is same for mysql and hsqldb? HSQL doc says that UUID has been activated. http://hsqldb.org/doc/guide/builtinfunctions-chapt.html

Thanks.


Solution

  • Turn on the MySQL compatibility mode in HSQLDB and it will allow your SELECT statement:

    http://hsqldb.org/doc/2.0/guide/compatibility-chapt.html#coc_compatibility_mysql