UUID Column without GENERATED BY DEFAULT:
SQL> CREATE TABLE UUID_TEST (id STRING AS UUID,name STRING, PRIMARY KEY (id));
Statement completed successfully
SQL> INSERT INTO UUID_TEST values("40c8dc55-f5ef-4af2-ad81-4d8ebc076f57", "test1");
Statement completed successfully
SQL> Commit:
UUID Column using GENERATED BY DEFAULT:
SQL> CREATE TABLE UUID_TEST (id STRING AS UUID GENERATED BY DEFAULT, name STRING, PRIMARY KEY (id));
Statement completed successfully
SQL> INSERT INTO UUID_TEST VALUES(default,"test1");
Statement completed successfully
Adding a UUID Column to an Existing Table:
SQL> CREATE TABLE UUID_TEST(id INTEGER,name STRING, PRIMARY KEY(id));
Statement completed successfully
SQL> ALTER TABLE UUID_TEST (ADD new_id STRING AS UUID GENERATED BY DEFAULT );
Statement completed successfully
Dropping a UUID Column:
SQL>ALTER TABLE UUID_TEST (DROP new_id);
No comments:
Post a Comment