关闭

自动生成杆塔

标签: triggerstableinsertattributesalignmentfloat
520人阅读 评论(0) 收藏 举报
分类:

------------插入直线塔--------------------------------------------------
//////
//////
//////改xlmc='包东甲线'和CD_XLMC.(线路代码在表cd_xlmcdm中找)
//////
//////
------------初始化杆塔类型。
set serveroutput on size 1000000;
alter table b$common_n disable all triggers;
alter table b$sd_gt_n disable all triggers;
alter table b$sd_gt_pt disable all triggers;
alter table b$sd_gt_pt_sdogeom disable all triggers;
alter table b$sd_gt_lb disable all triggers;
alter table b$sd_gt_lb_sdogeom disable all triggers;


create or replace procedure dz_gt_Create_sdgt IS
   v_lable_sdo_x1       FLOAT(126);
   v_lable_sdo_y1       FLOAT(126);
   v_sdo_x1           FLOAT(126);
   v_sdo_y1           FLOAT(126); 
   v_g3e_fno          number(5); 
   v_g3e_fid          number(10);
   v_g3e_cid            number(5);
   v_g3e_id             number(10);
   v_g3e_pt_id          number(10);
   v_g3e_sdogeom_id     number(10);
   v_label_g3e_id       number(10);
   v_gth  number(10,5);
   v_xlmc               varchar2(40);
 CURSOR c1 IS SELECT *  FROM z_gt a where xlmc='新肥线' ORDER BY gth;
BEGIN
 FOR c IN c1  LOOP
   v_g3e_fno:=378;
   v_g3e_cid:=1;
   v_gth:=c.gth;
   --取新加设备的g3e_fid
   SELECT sd_gt_n_seq.nextval INTO v_g3e_id FROM dual;
   SELECT sd_gt_pt_seq.nextval INTO v_g3e_pt_id FROM dual;
   SELECT sd_gt_pt_sdogeom_seq.nextval INTO v_g3e_sdogeom_id FROM dual;
   SELECT sd_gt_lb_seq.nextval INTO v_label_g3e_id FROM dual;
   SELECT g3e_fid_seq.nextval INTO v_g3e_fid FROM dual;
   --杆塔图像及标注坐标。
   v_sdo_x1:=c.x;
   v_sdo_y1:=c.y;
   v_xlmc:=c.xlmc;
   v_lable_sdo_x1:=v_sdo_x1+15;
   v_lable_sdo_y1:=v_sdo_y1+20;
   --------公共表属性------------------------
   --/*-----------------
   INSERT INTO b$common_n

(G3E_ID,G3E_FNO,G3E_CNO,G3E_FID,G3E_CID,sbmc,CD_DYDJ,CD_ZT,CD_JKZT,CD_SSDW)
   VALUES(

common_n_seq.nextval,v_g3e_fno,30,v_g3e_fid,v_g3e_cid,v_gth,'66kV','运行','一

类','供电公司');  
   --------插入图形的属性值------------------------
   INSERT INTO b$sd_gt_n(G3E_ID,G3E_FNO,G3E_CNO,G3E_FID,G3E_CID,CD_XLMC,GTH)
   VALUES

(sd_gt_n_seq.nextval,v_g3e_fno,26304,v_g3e_fid,v_g3e_cid,'22B213',v_gth);   
   --------插入图形的表------------------------
   INSERT INTO b$sd_gt_pt(g3e_id,g3e_fno,g3e_cno,g3e_fid,g3e_cid)
   VALUES( v_g3e_pt_id,v_g3e_fno,26305,v_g3e_fid,v_g3e_cid);
dbms_output.put_line(v_sdo_x1||'  '||v_sdo_y1);
   INSERT INTO b$sd_gt_pt_sdogeom(sdo_x1,sdo_y1,
  

sdo_gid,sdo_eseq,sdo_etype,sdo_seq,gdo_attributes,g3e_id,g3e_fno,g3e_cno,g3e_

fid,g3e_cid)
   VALUES(v_sdo_x1,v_sdo_y1,v_g3e_pt_id,0,1,0,65536,
          sd_gt_pt_sdogeom_seq.nextval,v_g3e_fno,26305,v_g3e_fid,v_g3e_cid);

   --------插入坐标图形------------------------
   INSERT INTO b$sd_gt_lb

(g3e_id,g3e_fno,g3e_cno,g3e_fid,g3e_cid,g3e_alignment)
   VALUES( v_label_g3e_id,v_g3e_fno,26306,v_g3e_fid,v_g3e_cid,5);

   INSERT INTO b$sd_gt_lb_sdogeom(sdo_x1,sdo_y1,
  

sdo_gid,sdo_eseq,sdo_etype,sdo_seq,gdo_attributes,g3e_id,g3e_fno,g3e_cno,g3e_

fid,g3e_cid)
   VALUES(v_lable_sdo_x1,v_lable_sdo_y1,v_label_g3e_id,0,1,0,65536,
          sd_gt_lb_sdogeom_seq.nextval,v_g3e_fno,26306,v_g3e_fid,v_g3e_cid);
  --*/
  dbms_output.put_line(v_sdo_x1||'  '||v_sdo_y1);
  END LOOP;
  commit; 
END;
/

exec dz_gt_Create_sdgt;
 


 alter table b$common_n enable all triggers;
 alter table b$sd_gt_n enable all triggers;
 alter table b$sd_gt_pt enable all triggers;
 alter table b$sd_gt_pt_sdogeom enable all triggers;
 alter table b$sd_gt_lb enable all triggers;
 alter table b$sd_gt_lb_sdogeom enable all triggers;
---到此杆塔的数据生成完成-------------------------

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:4496次
    • 积分:95
    • 等级:
    • 排名:千里之外
    • 原创:5篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章存档