以下的文章主要介紹的是Oracle spatial空間數據表的實際操作的初始化,當項目快運行完之時,我們要打算做點關於Oracle spatial的經驗總結,首先我們是以最簡單的開始來對其進行描述,以下就是文章的具體內容分析。
Oracle spatial空間數據表的初始化
Sql代碼
1.修改表結構
- ALTER TABLE Dev_Acrossbox
- ADD (
- LOCATION MDSYS.SDO_GEOMETRY default null ,
- MI_STYLE VARCHAR2(254) default null ,
- MI_PRINX NUMBER(10) default null
- );
2.插入METADATA屬性數據
- INSERT INTO USER_SDO_GEOM_METADATA
- VALUES(
- 'DEV_TOWER_ACTL',
- 'location',
- MDSYS.SDO_DIM_ARRAY(
- MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.0011119487),
- MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.0011119487)
- ),
- 8307
- );
3.創建空間索引
- CREATE INDEX IDX_SPATIAL_Dev_Acrossbox
- ON Dev_Acrossbox (location)
- INDEXTYPE IS MDSYS.SPATIAL_INDEX;
4.Oracle spatial空間數據表的初始化:執行PL/SQL
線
- declare
- v_type MAPINFO_MAPCATALOG%rowtype;
- begin
- select * into v_type from mapinfo_mapcatalog m where m.tablename='LINE_INFO' and m.ownername='POSTGIS' ;
- v_type.tablename:=&new_tableName;
- insert into MAPINFO_MAPCATALOG values v_type ;
- commit;
- dbms_output.put_line(v_type.tablename);
- end;
點
- declare
- v_type MAPINFO_MAPCATALOG%rowtype;
- begin
- select * into v_type from mapinfo_mapcatalog m where m.tablename='DEV_TRANSTATION' and m.ownername='POSTGIS' ;
- v_type.tablename:=&new_tableName;
- insert into MAPINFO_MAPCATALOG values v_type ;
- commit;
- dbms_output.put_line(v_type.tablename);
- end;
1.修改表結構
- ALTER TABLE Dev_Acrossbox
- ADD (
- LOCATION MDSYS.SDO_GEOMETRY default null ,
- MI_STYLE VARCHAR2(254) default null ,
- MI_PRINX NUMBER(10) default null
- );