</pre><pre code_snippet_id="456198" snippet_file_name="blog_20140822_2_1890999" name="code" class="sql">1:更新数据create or replace procedure UpdatePoly(tablename in nvarchar2,
keyfield in nvarchar2,
keyvalue in nvarchar2,
srid in nvarchar2,
poly in clob) as
strsql varchar2(8000);
begin
strsql := 'update '|| tablename ||' set shape= sde.st_polygon('''|| poly ||''','||srid||') where '|| keyfield ||'='''|| keyvalue||''''; execute immediate strsql;
commit;
end;
2:更新空间数据:
create or replace procedure UpdatePoly(keyvalue in nvarchar2,
srid in INTEGER,
poly in clob) as
geom sde.st_geometry;
begin
geom:=sde.st_polyfromtext(poly,srid);
update SP_ARCHIVESREDLINE t set t.shape = geom where t.archivesid = keyvalue;
commit;
end;
本文介绍了两种在Oracle数据库中更新空间数据的方法。第一种方法通过创建一个存储过程UpdatePoly,接收表格名、关键字字段、关键字值、SRID及Polygon CLOB作为参数,构造并执行SQL语句来更新指定记录的空间数据。第二种方法同样使用UpdatePoly存储过程,但直接通过SDE.ST_PolygonFromText函数转换Polygon CLOB,并更新指定档案ID的空间数据。
605





