使用Sql插入sde是ObjectId的处理方式

使用ArcGIS导入或新增数据时,objectid会自动自增,但通过sql时,则需要手动调用sde的函数sde.next_rowid来处理,否则可能导入objectid的重复;

  • next_rowid的定义

Next_RowID 将注册到地理数据库的表作为输入参数,并返回 ObjectID (RowID) 字段的下一个值。
使用 SQL 将一行插入到表中时,可以使用此值。
如果您指定的表未注册到地理数据库,则返回错误

1
<geodatabase administrator schema>.next_rowid (<table owner>, <table name>)

在大多数地理数据库中,地理数据库管理员方案是 sde。但是,在 SQL Server dbo 方案地理数据库中,则为 dbo;而在 Oracle 用户方案地理数据库中,则为用户方案的名称。 

  • PostgreSQL
1
2
3
4
5
INSERT INTO webman.applicants (objectid, app_name, status)
VALUES
(sde.next_rowid('webman', 'applicants'), 'Roy Bean', 'active')
 
Query returned successfully: 1 row affected, 109 ms execution time.

 

1
2
3
4
5
INSERT INTO webman.logins (id, l_name)
VALUES
(sde.next_rowid('WEBMAN', 'LOGINS'), 'maplebutter')
 
Notice: Class webman.logins not registered to the Geodatabase.
  • Oracle
1
2
3
4
5
6
7
INSERT INTO webman.applicants (objectid, app_name, status)
VALUES
(sde.gdb_util.next_rowid('WEBMAN', 'APPLICANTS'), 'Roy Bean', 'active');
 
1 row created
 
COMMIT;

 

1
2
3
4
5
6
7
8
9
INSERT INTO webman.logins (id, l_name)
VALUES
(sde.gdb_util.next_rowid('WEBMAN', 'LOGINS'), 'maplebutter');
 
 
(sde.gdb_util.next_rowid('WEBMAN', 'LOGINS'), 'maplebutter');
 *
ERROR at line 3:
ORA-20220: Class WEBMAN.LOGINS not registered to the Geodatabase.

 

 

参考地址:https://resources.arcgis.com/zh-cn/help/main/10.1/index.html#/na/006z000000w8000000/

posted @   xingtian  阅读(84)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示