Inserting a value into a global ID or GUID column in Oracle using SQL
Global ID and GUID data types store registry-style strings consisting of 36 characters enclosed in curly brackets. These strings uniquely identify a feature or table row within a geodatabase and across geodatabases. Global IDs are used to maintain uniqueness of records in one-way and two-way geodatabase replicas and nonversioned data used in offline maps. GUIDs can be added to any table.
If the table you want to edit participates in replication or offline maps or contains a GUID column, you must insert a unique value to the global ID or GUID column when you insert a new record to the table using SQL. To do this, you can use the sde.gdb_util.next_globalid utility.
When editing a nonversioned table that is not enabled for archiving, use the utility to insert the ID directly to the table. When editing a nonversioned table that is enabled for archiving, use the utility to insert the ID to the archive view of the table. When editing a versioned table, use the utility to insert a value to the versioned view of the table.
- Open an SQL editor, such as SQL*Plus.
-
Connect to the database as a user with privileges to edit the table.
If editing through a versioned or archive view, the user must also have privileges to edit the view.
-
When inserting a record, use the sde.gdb_util.next_globalid utility to insert the next global ID or GUID value.
In this example, a record is inserted to mytable. The table contains an ObjectID and an ST_Geometry column.
INSERT INTO user22.mytable (objectid, globalid, shape) VALUES ( sde.gdb_util.next_rowid('USER22', "MYTABLE'), sde.gdb_util.next_globalid(), (sde.st_polygon('polygon ((10000 520000, 100008889 55000, 1045545983 234280934, 10000 520000))',4326)) );
- When you have completed your edits, commit them to the database.