下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年县乡教师选调考试《教育学》试卷及参考答案详解(培优)
- 2026年县乡教师选调考试《教育学》经典例题附答案详解(考试直接用)
- 2025年注册岩土工程师之《岩土基础知识》练习题库及参考答案详解(a卷)
- 制冷工QC管理能力考核试卷含答案
- 余压利用工QC管理竞赛考核试卷含答案
- 轧制加热工道德模拟考核试卷含答案
- 2025年注册岩土工程师之《岩土基础知识》模拟试题附答案详解(精练)
- 2025年县乡教师选调考试《教育学》考试题库及答案详解(名师系列)
- 2026年北京市《保密知识竞赛必刷100题》考试题库含答案详解(典型题)
- 2025年游戏测试工程师职业水平评定试卷及答案
- 2026青海交通控股集团校招面试题及答案
- GB/T 46692.2-2025工作场所环境用气体探测器第2部分:有毒气体探测器的选型、安装、使用和维护
- 精准护理实践儿童康复护理课件
- TCBDA63-2022建筑装饰室内石材及瓷板干挂技术规程
- 公猪站培训课件
- 2025年特色美食街区开发可行性研究报告
- 7793-2025中小学校教室采光和照明卫生标准
- 自动喷水灭火系统
- 荆门市中石油2025秋招写作申论万能模板直接套用
- 沥青薄层罩面技术
- 2025年2月计算机维修工五级考试题(含答案)
评论
0/150
提交评论