To Use a GUID Field for an Existing Table
-
Add the ID field of type vachar2.
PK VARCHAR2(64));
-
Set the ID field to a GUID following XFM syntax.
UPDATE BUILDINGS SET PK = LOWER (substr(sys_guid(), 1, 8)||'-'||substr(sys_guid(),9,4)||'-'||substr(sys_guid(),13,4)||'-'||substr(sys_guid(),17,4)||'-'||substr(sys_guid(),21,12));
-
Set the primary key for the table.
ALTER TABLE BUILDINGS ADD CONSTRAINT BUILDINGS_PK PRIMARY KEY (PK);