Is there a way to create an auto-incrementing Guid primary key in an Oracle database?

I mainly work with sql server (when I work with databases) and I am trying to learn pl-sql.

Is there any equivalent of sql-server guid auto-generation as primary keys in Oracle?

+3
source share
2 answers

You can use SYS_GUID()to create a GUID and use it as the DEFAULT value for the column:

CREATE TABLE test_table (
  uid_col RAW(32) DEFAULT SYS_GUID(),
  some_val VARCHAR2(10)
);

EDIT : See the answers to this question for more details .

+6
source

Make the char or varchar2 column data type differently raw to convey future issues.

-1

Source: https://habr.com/ru/post/1733271/


All Articles