ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 生成IP地址列表

生成IP地址列表

原创 Linux操作系统 作者:zhouly1861 时间:2009-01-15 16:03:16 0 删除 编辑

create or replace procedure p_wxip 
as
I_V1 int;
I_V2 int;
I_V3 int;
I_V4 int;
I_A1 int;
I_A2 int;
I_A3 int;
I_A4 int;
I_B1 int;
I_B2 int;
I_B3 int;
I_B4 int;
begin
  UPDATE TMP_WX SET F0=0;
  UPDATE TMP_WX SET F0=4 WHERE F0=0 AND A1<>B1;
  UPDATE TMP_WX SET F0=3 WHERE F0=0 AND A2<>B2;
  UPDATE TMP_WX SET F0=2 WHERE F0=0 AND A3<>B3;
  UPDATE TMP_WX SET F0=1 WHERE F0=0 AND A4<>B4;
  EXECUTE IMMEDIATE 'truncate table tmp_wxip';
  COMMIT;
/*0*/ 
  INSERT INTO tmp_wxip (IP,ID0)SELECT to_char(a1)||'.'||to_char(a2)||'.'||to_char(a3)||'.'||to_char(a4),ID  FROM  tmp_wx WHERE F0=0 ;
  COMMIT;
/*1*/
  FOR cur IN (SELECT * FROM TMP_WX  WHERE F0=1) LOOP
      I_A4:=cur.A4;
      I_B4:=cur.B4;
     
      I_V4:=I_A4;
      WHILE I_V4<=I_B4
      LOOP
          INSERT INTO tmp_wxip (IP,ID0) values ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(cur.A3)||'.'||to_char(I_V4),cur.ID ) ;         
          I_V4:=I_V4+1;
      END LOOP;
  END LOOP;
  COMMIT;
/*2**/
  FOR cur IN (SELECT * FROM TMP_WX WHERE F0=2) LOOP
      I_A3:=cur.A3;
      I_B3:=cur.B3;
      I_A4:=cur.A4;
      I_B4:=cur.B4;
  /*2**I_V3:=I_A3*/ 
      I_V4:=I_A4;
      WHILE I_V4<256
      LOOP             
          INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(cur.A3)||'.'||to_char(I_V4),cur.ID);
          I_V4:=I_V4+1;
      END LOOP;
  /*2**I_A3      I_V3:=I_A3+1;
      WHILE I_V3      LOOP
          I_V4:=0;
          WHILE I_V4<256
          LOOP             
              INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
              I_V4:=I_V4+1;
          END LOOP;
          I_V3:=I_V3+1;
      END LOOP;
  /*2**I_V3:=I_B3*/      
      I_V4:=0;
      WHILE I_V4<=I_B4
      LOOP         
          INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.B1)||'.'||to_char(cur.B2)||'.'||to_char(cur.B3)||'.'||to_char(I_V4),cur.ID);
          I_V4:=I_V4+1;
      END LOOP;
      COMMIT;
  END LOOP;
/*3**/
  FOR cur IN (SELECT * FROM TMP_WX WHERE F0=3) LOOP
      I_A2:=cur.A2;
      I_B2:=cur.B2;
      I_A3:=cur.A3;
      I_B3:=cur.B3;
      I_A4:=cur.A4;
      I_B4:=cur.B4;
/*3**I_V2:=I_A2/
  /*2**I_V3:=I_A3*/ 
        I_V4:=I_A4;
        WHILE I_V4<256
        LOOP             
            INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(cur.A3)||'.'||to_char(I_V4),cur.ID);
            I_V4:=I_V4+1;
        END LOOP;
  /*2**I_A3        I_V3:=I_A3+1;
        WHILE I_V3        LOOP
            I_V4:=0;
            WHILE I_V4<256
            LOOP             
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
            I_V3:=I_V3+1;
        END LOOP;
  /*2**I_V3:=I_B3*/      
        I_V4:=0;
        WHILE I_V4<=I_B4
        LOOP         
            INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.B1)||'.'||to_char(cur.B2)||'.'||to_char(cur.B3)||'.'||to_char(I_V4),cur.ID);
            I_V4:=I_V4+1;
        END LOOP;
        COMMIT;

/*3**I_A2      I_V2:=I_A2+1;     
      WHILE I_V2      LOOP
          I_V3:=0;
          WHILE I_V3<256
          LOOP
              I_V4:=0;
              WHILE I_V4<256
              LOOP                 
                  INSERT INTO tmp_wxip (IP,ID0)values (to_char(cur.B1)||'.'||to_char(I_V2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                  I_V4:=I_V4+1;
              END LOOP;
              I_V3:=I_V3+1;
          END LOOP;
          I_V2:=I_V2+1;
      END LOOP;
      COMMIT;
/*3**I_V2:=I_B2/
  /*2**I_V3:=I_A3*/ 
        I_V4:=I_A4;
        WHILE I_V4<256
        LOOP             
            INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.B2)||'.'||to_char(cur.A3)||'.'||to_char(I_V4),cur.ID);
            I_V4:=I_V4+1;
        END LOOP;
  /*2**I_A3        I_V3:=I_A3+1;
        WHILE I_V3        LOOP
            I_V4:=0;
            WHILE I_V4<256
            LOOP             
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.B2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
            I_V3:=I_V3+1;
        END LOOP;
  /*2**I_V3:=I_B3*/      
        I_V4:=0;
        WHILE I_V4<=I_B4
        LOOP         
            INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.B1)||'.'||to_char(cur.B2)||'.'||to_char(cur.B3)||'.'||to_char(I_V4),cur.ID);
            I_V4:=I_V4+1;
        END LOOP;
        COMMIT;
  END LOOP;
 
/*4**/
  FOR cur IN (SELECT * FROM TMP_WX WHERE F0=4) LOOP
      I_A1:=cur.A1;
      I_B1:=cur.B1;
      I_A2:=cur.A2;
      I_B2:=cur.B2;
      I_A3:=cur.A3;
      I_B3:=cur.B3;
      I_A4:=cur.A4;
      I_B4:=cur.B4;
/*4**I_V1:=I_A1/
    /*3**I_V2:=I_A2/
      /*2**I_V3:=I_A3*/ 
            I_V4:=I_A4;
            WHILE I_V4<256
            LOOP             
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(cur.A3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
      /*2**I_A3            I_V3:=I_A3+1;
            WHILE I_V3            LOOP
                I_V4:=0;
                WHILE I_V4<256
                LOOP             
                    INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                    I_V4:=I_V4+1;
                END LOOP;
                I_V3:=I_V3+1;
            END LOOP;
      /*2**I_V3:=I_B3*/      
            I_V4:=0;
            WHILE I_V4<=I_B4
            LOOP         
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.B1)||'.'||to_char(cur.B2)||'.'||to_char(cur.B3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
            COMMIT;

    /*3**I_A2          I_V2:=I_A2+1;     
          WHILE I_V2          LOOP
              I_V3:=0;
              WHILE I_V3<256
              LOOP
                  I_V4:=0;
                  WHILE I_V4<256
                  LOOP                 
                      INSERT INTO tmp_wxip (IP,ID0)values (to_char(cur.B1)||'.'||to_char(I_V2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                      I_V4:=I_V4+1;
                  END LOOP;
                  I_V3:=I_V3+1;
              END LOOP;
              I_V2:=I_V2+1;
          END LOOP;
          COMMIT;
    /*3**I_V2:=I_B2/
      /*2**I_V3:=I_A3*/ 
            I_V4:=I_A4;
            WHILE I_V4<256
            LOOP             
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.B2)||'.'||to_char(cur.A3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
      /*2**I_A3            I_V3:=I_A3+1;
            WHILE I_V3            LOOP
                I_V4:=0;
                WHILE I_V4<256
                LOOP             
                    INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.B2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                    I_V4:=I_V4+1;
                END LOOP;
                I_V3:=I_V3+1;
            END LOOP;
      /*2**I_V3:=I_B3*/      
            I_V4:=0;
            WHILE I_V4<=I_B4
            LOOP         
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.B1)||'.'||to_char(cur.B2)||'.'||to_char(cur.B3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
            COMMIT;

/*4**I_A1      I_V1:=I_A1+1;     
      WHILE I_V1      LOOP
          I_V2:=0;
          WHILE I_V2<256
          LOOP
              I_V3:=0;
              WHILE I_V3<256
              LOOP
                  I_V4:=0;
                  WHILE I_V4<256
                  LOOP                 
                      INSERT INTO tmp_wxip (IP,ID0)values (to_char(I_V1)||'.'||to_char(I_V2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                      I_V4:=I_V4+1;
                  END LOOP;
                  I_V3:=I_V3+1;
              END LOOP;
              I_V2:=I_V2+1;
          END LOOP;
          I_V1:=I_V1+1;
      END LOOP;
      COMMIT;
/*4**I_V1:=I_B1/
    /*3**I_V2:=I_A2/
      /*2**I_V3:=I_A3*/ 
            I_V4:=I_A4;
            WHILE I_V4<256
            LOOP             
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(cur.A3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
      /*2**I_A3            I_V3:=I_A3+1;
            WHILE I_V3            LOOP
                I_V4:=0;
                WHILE I_V4<256
                LOOP             
                    INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.A2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                    I_V4:=I_V4+1;
                END LOOP;
                I_V3:=I_V3+1;
            END LOOP;
      /*2**I_V3:=I_B3*/      
            I_V4:=0;
            WHILE I_V4<=I_B4
            LOOP         
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.B1)||'.'||to_char(cur.B2)||'.'||to_char(cur.B3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
            COMMIT;

    /*3**I_A2          I_V2:=I_A2+1;     
          WHILE I_V2          LOOP
              I_V3:=0;
              WHILE I_V3<256
              LOOP
                  I_V4:=0;
                  WHILE I_V4<256
                  LOOP                 
                      INSERT INTO tmp_wxip (IP,ID0)values (to_char(cur.B1)||'.'||to_char(I_V2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                      I_V4:=I_V4+1;
                  END LOOP;
                  I_V3:=I_V3+1;
              END LOOP;
              I_V2:=I_V2+1;
          END LOOP;
          COMMIT;
    /*3**I_V2:=I_B2/
      /*2**I_V3:=I_A3*/ 
            I_V4:=I_A4;
            WHILE I_V4<256
            LOOP             
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.B2)||'.'||to_char(cur.A3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
      /*2**I_A3            I_V3:=I_A3+1;
            WHILE I_V3            LOOP
                I_V4:=0;
                WHILE I_V4<256
                LOOP             
                    INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.A1)||'.'||to_char(cur.B2)||'.'||to_char(I_V3)||'.'||to_char(I_V4),cur.ID);
                    I_V4:=I_V4+1;
                END LOOP;
                I_V3:=I_V3+1;
            END LOOP;
      /*2**I_V3:=I_B3*/      
            I_V4:=0;
            WHILE I_V4<=I_B4
            LOOP         
                INSERT INTO tmp_wxip (IP,ID0)VALUES ( to_char(cur.B1)||'.'||to_char(cur.B2)||'.'||to_char(cur.B3)||'.'||to_char(I_V4),cur.ID);
                I_V4:=I_V4+1;
            END LOOP;
            COMMIT;
 
  END LOOP;
end ;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8797129/viewspace-539741/,如需转载,请注明出处,否则将追究法律责任。

下一篇: /etc/rc.d/init.d
请登录后发表评论 登录
全部评论

注册时间:2008-08-03

  • 博文量
    53
  • 访问量
    107045