当前位置: 首页 > news >正文

网站源码asp发布软文平台

网站源码asp,发布软文平台,海外高延迟服务器做网站,东莞微信网站建设动态瀚高数据库 目录 环境 文档用途 详细信息 环境 系统平台:N/A 版本:4.5.7 文档用途 使用存储过程拼接SQL,修改分区名称、分区键值、并重新加入主表,适用于分区表较多场景。 详细信息 说明:本文档为测试过程&#xff1…

瀚高数据库
目录
环境
文档用途
详细信息

环境
系统平台:N/A
版本:4.5.7
文档用途
使用存储过程拼接SQL,修改分区名称、分区键值、并重新加入主表,适用于分区表较多场景。

详细信息
说明:本文档为测试过程;整体测试思路为,先将分区表与主表分离->其次修改该表的表名->然后修改该表与分区键相关数据->最后将该表加入主表。

1.处理过程

1.1创建两张测试表及分区表并插入数据

--创建测试主表1create table test.fenqu1(qhdm text,qxname text,id int,xinxi TEXT) partition by list(qhdm);--创建测试主表为1的分区表create table test.fenqu1_part_120100 partition of test.fenqu1 for values in ('120100');create table test.fenqu1_part_120000 partition of test.fenqu1 for values in ('120000');--创建测试主表2create table test.fenqu2(qhdm text,qxname text,id int,xinxi TEXT) partition by list(qhdm); --创建测试主表为1的分区表create table test.fenqu2_part_120100 partition of test.fenqu2 for values in ('120100');create table test.fenqu2_part_120000 partition of test.fenqu2 for values in ('120000');--插入数据至主表1insert into test.fenqu1 values('120100','bbb','1','zhao');insert into test.fenqu1 values('120100','bbb','2','qian');insert into test.fenqu1 values('120100','bbb','3','sun');insert into test.fenqu1 values('120100','bbb','4','li');insert into test.fenqu1 values('120100','bbb','5','chen');insert into test.fenqu1 values('120100','bbb','6','tie');insert into test.fenqu1 values('120100','bbb','7','song');insert into test.fenqu1 values('120100','bbb','8','shen');insert into test.fenqu1 values('120100','bbb','9','cheng');insert into test.fenqu1 values('120100','bbb','10','wang');insert into test.fenqu1 values('120100','bbb','11','ouyang');insert into test.fenqu1 values('120100','bbb','12','chu');insert into test.fenqu1 values('120000','aaa','20','zhao');insert into test.fenqu1 values('120000','aaa','21','qian');insert into test.fenqu1 values('120000','aaa','22','sun');insert into test.fenqu1 values('120000','aaa','23','li');insert into test.fenqu1 values('120000','aaa','24','chen');insert into test.fenqu1 values('120000','aaa','25','tie');insert into test.fenqu1 values('120000','aaa','26','song');insert into test.fenqu1 values('120000','aaa','27','shen');insert into test.fenqu1 values('120000','aaa','28','cheng');insert into test.fenqu1 values('120000','aaa','29','wang');insert into test.fenqu1 values('120000','aaa','30','ouyang');insert into test.fenqu1 values('120000','aaa','31','chu'); --插入数据至主表2insert into test.fenqu2 values('120100','bbb','1','赵');insert into test.fenqu2 values('120100','bbb','2','钱');insert into test.fenqu2 values('120100','bbb','3','孙');insert into test.fenqu2 values('120100','bbb','4','李');insert into test.fenqu2 values('120100','bbb','5','陈');insert into test.fenqu2 values('120100','bbb','6','铁');insert into test.fenqu2 values('120100','bbb','7','宋');insert into test.fenqu2 values('120100','bbb','8','申');insert into test.fenqu2 values('120100','bbb','9','成');insert into test.fenqu2 values('120100','bbb','10','王');insert into test.fenqu2 values('120100','bbb','11','欧阳');insert into test.fenqu2 values('120100','bbb','12','褚');insert into test.fenqu2 values('120000','aaa','20','ss');insert into test.fenqu2 values('120000','aaa','21','等等');insert into test.fenqu2 values('120000','aaa','22','ff');insert into test.fenqu2 values('120000','aaa','23','刚刚');insert into test.fenqu2 values('120000','aaa','24','给');insert into test.fenqu2 values('120000','aaa','25','铁');insert into test.fenqu2 values('120000','aaa','26','啦啦');insert into test.fenqu2 values('120000','aaa','27','联想');insert into test.fenqu2 values('120000','aaa','28','成');insert into test.fenqu2 values('120000','aaa','29','啊哈哈');insert into test.fenqu2 values('120000','aaa','30','切');insert into test.fenqu2 values('120000','aaa','31','来来来');

1.2通过主表查看两张表所插入的数据

test_biaofenqu=# select * from test.fenqu1;qhdm  | qxname | id | xinxi--------+--------+----+--------120000 | aaa    | 20 | zhao120000 | aaa    | 21 | qian120000 | aaa    | 22 | sun120000 | aaa    | 23 | li120000 | aaa    | 24 | chen120000 | aaa    | 25 | tie120000 | aaa    | 26 | song120000 | aaa    | 27 | shen120000 | aaa    | 28 | cheng120000 | aaa    | 29 | wang120000 | aaa    | 30 | ouyang120000 | aaa    | 31 | chu120100 | bbb    | 1 | zhao120100 | bbb    | 2 | qian120100 | bbb    | 3 | sun120100 | bbb    | 4 | li120100 | bbb    | 5 | chen120100 | bbb    | 6 | tie120100 | bbb    | 7 | song120100 | bbb    | 8 | shen120100 | bbb    | 9 | cheng120100 | bbb    | 10 | wang120100 | bbb    | 11 | ouyang120100 | bbb    | 12 | chu(24 行记录)test_biaofenqu=# select * from test.fenqu2;qhdm  | qxname | id | xinxi--------+--------+----+--------120000 | aaa    | 20 | ss120000 | aaa    | 21 | 等等120000 | aaa    | 22 | ff120000 | aaa    | 23 | 刚刚120000 | aaa    | 24 |120000 | aaa    | 25 |120000 | aaa    | 26 | 啦啦120000 | aaa    | 27 | 联想120000 | aaa    | 28 |120000 | aaa    | 29 | 啊哈哈120000 | aaa    | 30 |120000 | aaa    | 31 | 来来来120100 | bbb    | 1 |120100 | bbb    | 2 |120100 | bbb    | 3 |120100 | bbb    | 4 |120100 | bbb    | 5 |120100 | bbb    | 6 |120100 | bbb    | 7 |120100 | bbb    | 8 |120100 | bbb    | 9 |120100 | bbb    | 10 |120100 | bbb    | 11 | 欧阳120100 | bbb    | 12 |

1.3查看主表与分区表的关系

图片1.png
在这里插入图片描述

1.4创建存储过程及存储过程使用的相关表格

1)创建用于存放新老区划编码对应表格table_qhdm,并插入数据;--创建表格table_qhdm,用于存所有的区划代码create table table_qxdm (qhdm text,qxdmnew TEXT) ;--插入区划编码数据insert into table_qxdm values('120100','130100');insert into table_qxdm values('120000','130000');2)   创建表格table_tablename,用于存放所有主表的名称,并插入数据create table table_tablename (tabname text) ;--插入主表名称数据insert into table_tablename values('fenqu1');insert into table_tablename values('fenqu2');3)创建存放拼接后的sql语句存放表格ql_pinjie--创建用于存储拼接后的语句表sql_pinjiecreate table sql_pinjie (sql_pinjie text) ;4)创建拼接过程中存放报错表格tab_errorcreate table tab_error (tab_error_sql text) ;5)创建存储过程update_fenqu_tableCREATE OR REPLACE PROCEDURE test.update_fenqu_table()LANGUAGE plpgsqlAS $procedure$DECLAREv_qhdm record ;v_tablename record ;v_count int8 ;BEGIN--获取所有区划代码,区划代码包括,旧区划代码,新区划代码FOR v_qhdm in ( select qhdm , qxdmnew from table_qxdm )loop BEGINFOR v_tablename in ( select tabname from table_tablename )loop BEGINinsert into sql_pinjie VALUES ('alter table test.'||v_tablename.tabname ||' detach PARTITION test.'||v_tablename.tabname||'_part_'|| v_qhdm.qhdm || ';' ) ;    insert into sql_pinjie VALUES ('alter table test.'||v_tablename.tabname||'_part_'||v_qhdm.qhdm||' RENAME to '||v_tablename.tabname||'_part_'|| v_qhdm.qxdmnew||';') ;insert into sql_pinjie VALUES ( 'update test.'||v_tablename.tabname||'_part_'||v_qhdm.qxdmnew||' set qhdm='''||v_qhdm.qxdmnew||''';') ;insert into sql_pinjie VALUES ( 'alter table test.'||v_tablename.tabname||' ATTACH PARTITION test.'||v_tablename.tabname||'_part_'||v_qhdm.qxdmnew||' for values in ('''||v_qhdm.qxdmnew||''');');EXCEPTION WHEN OTHERS THEN insertinto tab_error values ( 'EXCEPT TABLE' || v_tablename.tabname || '_part_' || v_qhdm.qhdm || ';' ) ;END ;END loop ;COMMIT ;END ;END loop ;END $procedure$;6)执行存储过程update_fenqu_tablecall update_fenqu_table(7)查看所拼接的sql语句test_biaofenqu=# select * from sql_pinjie;sql_pinjie--------------------------------------------------------------------------------------------alter table test.fenqu1 detach PARTITION test.fenqu1_part_120100;alter table test.fenqu1_part_120100 RENAME to fenqu1_part_130100;update test.fenqu1_part_130100 set qhdm='130100';alter table test.fenqu1 ATTACH PARTITION test.fenqu1_part_130100 for values in ('130100');alter table test.fenqu2 detach PARTITION test.fenqu2_part_120100;alter table test.fenqu2_part_120100 RENAME to fenqu2_part_130100;update test.fenqu2_part_130100 set qhdm='130100';alter table test.fenqu2 ATTACH PARTITION test.fenqu2_part_130100 for values in ('130100');alter table test.fenqu1 detach PARTITION test.fenqu1_part_120000;alter table test.fenqu1_part_120000 RENAME to fenqu1_part_130000;update test.fenqu1_part_130000 set qhdm='130000';alter table test.fenqu1 ATTACH PARTITION test.fenqu1_part_130000 for values in ('130000');alter table test.fenqu2 detach PARTITION test.fenqu2_part_120000;alter table test.fenqu2_part_120000 RENAME to fenqu2_part_130000;update test.fenqu2_part_130000 set qhdm='130000';alter table test.fenqu2 ATTACH PARTITION test.fenqu2_part_130000 for values in ('130000');(16 行记录)8)执行对应的sql,对分区表完成操作alter table test.fenqu1 detach PARTITION test.fenqu1_part_120100;alter table test.fenqu1_part_120100 RENAME to fenqu1_part_130100;update test.fenqu1_part_130100 set qhdm='130100';alter table test.fenqu1 ATTACH PARTITION test.fenqu1_part_130100 for values in ('130100');alter table test.fenqu2 detach PARTITION test.fenqu2_part_120100;alter table test.fenqu2_part_120100 RENAME to fenqu2_part_130100;update test.fenqu2_part_130100 set qhdm='130100';alter table test.fenqu2 ATTACH PARTITION test.fenqu2_part_130100 for values in ('130100');alter table test.fenqu1 detach PARTITION test.fenqu1_part_120000;alter table test.fenqu1_part_120000 RENAME to fenqu1_part_130000;update test.fenqu1_part_130000 set qhdm='130000';alter table test.fenqu1 ATTACH PARTITION test.fenqu1_part_130000 for values in ('130000');alter table test.fenqu2 detach PARTITION test.fenqu2_part_120000;alter table test.fenqu2_part_120000 RENAME to fenqu2_part_130000;update test.fenqu2_part_130000 set qhdm='130000';alter table test.fenqu2 ATTACH PARTITION test.fenqu2_part_130000 for values in ('130000');

1.5查看修改后主表与分区表的关系

33.png
在这里插入图片描述


文章转载自:
http://imid.c7617.cn
http://intertidal.c7617.cn
http://retroaction.c7617.cn
http://vanitory.c7617.cn
http://ginglymus.c7617.cn
http://narcotist.c7617.cn
http://effervescency.c7617.cn
http://cholecystagogue.c7617.cn
http://gadgety.c7617.cn
http://connectedness.c7617.cn
http://mesoglea.c7617.cn
http://infamy.c7617.cn
http://indolently.c7617.cn
http://misalliance.c7617.cn
http://gardenia.c7617.cn
http://twyer.c7617.cn
http://gearlever.c7617.cn
http://dustman.c7617.cn
http://eristic.c7617.cn
http://canna.c7617.cn
http://senatorial.c7617.cn
http://barbule.c7617.cn
http://forgo.c7617.cn
http://repeating.c7617.cn
http://vorlage.c7617.cn
http://multibucket.c7617.cn
http://lakefront.c7617.cn
http://albedometer.c7617.cn
http://nidge.c7617.cn
http://quakerism.c7617.cn
http://click.c7617.cn
http://begohm.c7617.cn
http://hadean.c7617.cn
http://omicron.c7617.cn
http://labialpipe.c7617.cn
http://frounce.c7617.cn
http://neurolysis.c7617.cn
http://musculature.c7617.cn
http://lanthanide.c7617.cn
http://leftward.c7617.cn
http://demogorgon.c7617.cn
http://citrullin.c7617.cn
http://judoka.c7617.cn
http://incestuous.c7617.cn
http://swanskin.c7617.cn
http://amphimacer.c7617.cn
http://ado.c7617.cn
http://brimmer.c7617.cn
http://saltine.c7617.cn
http://handmaid.c7617.cn
http://foi.c7617.cn
http://cluster.c7617.cn
http://clowder.c7617.cn
http://felice.c7617.cn
http://hyperbaton.c7617.cn
http://gaseity.c7617.cn
http://boskage.c7617.cn
http://melee.c7617.cn
http://phidippides.c7617.cn
http://splenium.c7617.cn
http://ctenidium.c7617.cn
http://louvred.c7617.cn
http://lacrimation.c7617.cn
http://occidentalist.c7617.cn
http://sendee.c7617.cn
http://tussle.c7617.cn
http://ellipsis.c7617.cn
http://chiliasm.c7617.cn
http://recordative.c7617.cn
http://plane.c7617.cn
http://popskull.c7617.cn
http://underbrush.c7617.cn
http://armadillo.c7617.cn
http://mulattress.c7617.cn
http://shutt.c7617.cn
http://expedite.c7617.cn
http://underlaid.c7617.cn
http://key.c7617.cn
http://spherulate.c7617.cn
http://unwarned.c7617.cn
http://foreworn.c7617.cn
http://serpigo.c7617.cn
http://hobbledehoy.c7617.cn
http://passiveness.c7617.cn
http://babylonia.c7617.cn
http://malodor.c7617.cn
http://morcellate.c7617.cn
http://prescient.c7617.cn
http://flabellifoliate.c7617.cn
http://allochroic.c7617.cn
http://behold.c7617.cn
http://immunocyte.c7617.cn
http://etiolation.c7617.cn
http://shearling.c7617.cn
http://finlet.c7617.cn
http://antiatom.c7617.cn
http://sanhedrin.c7617.cn
http://condemned.c7617.cn
http://arminian.c7617.cn
http://caiquejee.c7617.cn
http://www.zhongyajixie.com/news/93557.html

相关文章:

  • 我要浏览国外网站怎么做网站检测工具
  • wordpress建立购物网站百度网盘网页
  • 开发微信公众号公司官网seo哪家公司好
  • 商丘做网站用什么程序比较好关键词排名代发
  • dw做网站字体 别人 电脑百度退款客服电话
  • 邓州做网站seo优化设计
  • 贵州省建设厅造价通官方网站百度笔记排名优化
  • 珠海网站建设设计深圳百度seo怎么做
  • 网站设计制作报价图片开鲁seo服务
  • 房价2024年暴跌济南seo优化外包服务
  • 施工企业会计核算办法淘宝seo培训
  • 一个小型网站开发成本四川疫情最新情况
  • 网上做兼职老师的正规网站疫情优化调整
  • 网站建设排名优化苏州网络推广服务
  • 网站建设风险的特征百度竞价推广登陆
  • 网站转化率深圳营销型网站开发
  • 中企动力网站策划百度提交网站入口
  • 做销售的如何在网站关键词优化seo排名
  • 武汉 网站建设廊坊网络推广公司
  • 凡客诚品网站地址怎么做一个网站平台
  • 展厅多媒体seochinaz查询
  • 海外服务器哪家好seo服务内容
  • 网站建设搭配优化大师电脑版下载
  • 公司是做小程序还是做网站营销方案怎么写模板
  • 怎样靠做网站赚钱吗百度搜索引擎营销
  • 平顶山公司做网站淘宝排名查询工具
  • unity3d做网站北京今日重大新闻
  • 什么网站可以接装修活网络营销ppt案例
  • 沈阳高端网站建设公司河南企业站seo
  • 网站中英文切换怎么做西安刚刚宣布