


下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、批量生成大数据量的SQL脚本-电脑资料业务逻辑:利用游标从数据库中现有的表数据,查询出部分属性,来插入到目标表中,来在目标表中生成大批量的数据,SQL实现如下:createorreplaceprocedureadd_subscription_c(i_countinnumb er,-i_count 输入值为循环插入记录的次数 i_usersegmentinvarchar2,i_startaccountinnumber,o_resultcode outnumber,o_resulstringoutvarchar2)asv_countnumber;v_startc ountnumber;v_sqlv
2、archar2(1024);v_subscriberzxdbm_ismp.ssrv_ subscription.subscriber%type;-订购方号码v_usercodezxdbm_ismp.ssrv_subscription.usercode%type;- 使用 号码v_payuserzxdbm_ismp.ssrv_subscription.payuser%type;-付费号码 v_servicekeyidzxdbm_ismp.ssys_service_type.servicekeyid%typ e;- 内部业务键 idv_statuszxdbm_ismp.ssrv_subscript
3、ion.status%type;-状态0-待生效; 1-正常;2:暂停+待生效;3:暂停;4:待失效;5:暂停待失效;6:注销,v_subscriptionindexzxdbm_ismp.ssrv_subscription.subscriptio nindex%type;- 定购关系顺序号 v_serviceindexzxdbm_ismp.ssrv_subscription.serviceindex%typ e;- 业务序号 v_serviceidzxdbm_ismp.ssrv_subscription.serviceid%type;-新业务 IDv_productidzxdbm_ismp.s
4、srv_ductid%type;- 产品 IDv_productindexzxdbm_ismp.ssrv_ductindex%t ype;- 产品序号 v_cpidzxdbm_ismp.ssrv_subscription.cpid%type;- CPIDv_cpindexzxdbm_ismp.ssrv_subscription.cpindex%type;-CP序号v_corpindexzxdbm_ismp.ssrv_subscription.corpindex%type;-集团序号v_corpidzxdbm_ismp.ssrv_s
5、ubscription.corpid%type;-集团IDv_msisdntypezxdbm_ismp.ssrv_subscription.msisdntype%type;- 用户号码类型, 1-msisdn,2-phs,3-pstn , 4-IPTV 接入号, 5- 宽带接入号, 6- 固定IPv_servicetypezxdbm_ismp.ssrv_subscription.servicetype%typ e;- 业务能力类型v_newCodezxdbm_ismp.ssrv_subscription.usercode%type;v_subnu mbernumber(10);typecur_
6、tisrefcursor;cur_productcur_t;begin- 缺省为300000000v_startcount:=30000000;ifi_startaccountisnotnullthenv_startcount:=i_startaccount;endif;- 构造用户号码v_usercode:=191;ifi_usersegmentisnotnullthenv_usercode:=i_usersegment;endif;v_msisdntype:=1;v_corpindex:=0;v_corpid: v_subnumber:=v_startcount;v_count:=v_st
7、artcount;-i_count输入值为循环的次数v_count 为缺省0whilev_count=(v_startcount+i_count)loop-组合生成号码v_newCode:=v_usercode|v_count;- 从产品表中找一条现成的数据 来得到订购关系表中一些属性值来插入订购关系opencur_productforselectservicetype,serviceindex,serviceid ,productindex,productid,status,cpid,cpindexfromv_ssrv_produ ctwhereproductid=1111000090200
8、00000030;loopfetchcur_produc tintov_servicetype,v_serviceindex,v_serviceid,v_productinde x,v_productid,v_status,v_cpid,v_cpindex;sp_get_next_seq(sl p_order_prdindex,v_subscriptionindex);exitwhencur_product% notfound;insertintozxdbm_500.s500_user_subscription(subscri ptionindex,subscriptionid,service
9、type,serviceindex,servicei d,productindex,productid,corpindex,corpid,subscriber,usercode,payuser,status,msisdntype,cpid,cpindex)values(v_subscrip tionindex,v_newCode|v_subscriptionindex,v_servicetype,v_se rviceindex,v_serviceid,v_productindex,v_productid,v_corpind ex,v_corpid,v_newCode,v_newCode,v_newCode,v_status,v_msisdn type,v_cpid,v_cpindex);v_subnumber:=v_subnumber+1;endloop;- -每 1000 条 commit 一次或 v_count=v_startcount+ 循环次数 ifmod(v_subnumber,1000)=0orv_count=(v_startcount+i_count)th encommit;endif;-在 v_startcount 的基础上+1v_count:=v_count+1;v_usercode:=i_usersegment;endloop;o_r
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026届江苏省扬州市江都区邵凡片重点达标名校中考数学最后一模试卷含解析
- 装饰公司总经办管理制度
- 监狱安全生产意识课件
- 面向自动驾驶汽车的室外单目ORB-SLAM技术研究
- 体温监测与护理安全流程
- 术后伤口护理及感染预防
- 重症病房护理中的安全保障机制
- 输液过程中护士核心技能的强化
- 肿瘤化疗期间的健康教育护理
- 健康管理与护理服务的整合查房
- 2025年小学科学课程标准考试测试题及答案
- 普及心理健康
- 2025届马鞍山市第二中学物理高二下期末监测试题含解析
- 心理健康教育:家长心理健康讲座
- 2026版高三一轮总复习(数学) 第二章 重点培优课1 函数性质的综合应用 课件
- QC品质工程图模板
- 2025年新高考1卷(新课标Ⅰ卷)英语试卷
- DB53∕T 1269-2024 改性磷石膏用于矿山废弃地生态修复回填技术规范
- 河北省沧州市2023-2024学年七年级下学期期末数学试题(冀教版)
- 艾滋病检测培训试题附答案
- GB/T 21928-2008食品塑料包装材料中邻苯二甲酸酯的测定
评论
0/150
提交评论