Skip to content

Commit

Permalink
Adding the script files
Browse files Browse the repository at this point in the history
  • Loading branch information
HackerTheMonkey committed May 4, 2012
1 parent 9c4e4ab commit 142f575
Show file tree
Hide file tree
Showing 243 changed files with 94,077 additions and 0 deletions.
Binary file added OracleSQLScripts/.DS_Store
Binary file not shown.
24 changes: 24 additions & 0 deletions OracleSQLScripts/DC.sql
@@ -0,0 +1,24 @@
--DC SQL Queries

--to find the subscribers that their credit limit is greater than one thousand dollars
Select a.acct_id,a.cust_id,a.credit_limit,a.Local_Id,b.group_name From dc_acct_credit_alarm a,dc_base_group b
Where (a.group_id = b.group_id) And a.credit_limit > 1000;

-- to find the number of roaming postpaid subscribers
Select * From dc_acct_credit_alarm a Where
a.group_id=(Select group_id From dc_base_group Where group_name='Roaming Group');

-- SMS Notifier Queries
-------------------------------------------------------------------------------------------------
Select Distinct (msisdn),t.local_id From inf_subscriber_all t,inf_acct v,inf_acct_relation r
Where sub_state In ('B01','B04') And v.acct_id = r.acct_id
And r.sub_id = t.sub_id And v.bill_cycle_type='22' Order By msisdn;

Select Distinct local_id From inf_subscriber_all;

Select Distinct (msisdn),t.local_id From inf_subscriber_all
t,inf_acct v,inf_acct_relation r Where sub_state In ('B01','B04')
And msisdn ='07704615001' And v.acct_id = r.acct_id And r.sub_id = t.sub_id
And v.bill_cycle_type='22' Order By msisdn;
---------------------------------------------------------------------------------------------------

35 changes: 35 additions & 0 deletions OracleSQLScripts/GPRS_AND_MMS_MONTHLY_ACTV_REPORTS.sql
@@ -0,0 +1,35 @@
Select a.sub_id From inf_products a Where a.product_id='S1162' And to_char(a.create_date,'yyyymm')='200809';
Select * From pdm_prodtab t Where lower(t.prod_name) Like '%gprs%';

-- Monthly report for MMS_GPRS_FREE service package (PPS_MMS&GPRS_FREE)
Select c.city,Count(*) no_of_activations From inf_products a,inf_subscriber_all b,tmp_numbering_plan c
Where
a.product_id='S1162' And
to_char(a.create_date,'yyyymm')='200809' And
a.sub_id=b.sub_id And
substr(b.imsi,1,7)=c.imsi_range
Group By c.city
Order By no_of_activations Desc;

-- Monthly report for MMS activations only (PPS_MMS)
Select c.city,Count(*) no_of_activations From inf_products a,inf_subscriber_all b,tmp_numbering_plan c
Where
a.product_id='S1161' And
to_char(a.create_date,'yyyymm')='200809' And
a.sub_id=b.sub_id And
substr(b.imsi,1,7)=c.imsi_range
Group By c.city
Order By no_of_activations Desc;

-- Monthly report for GPRS activations (PPS_GPRS)
Select c.city,Count(*) no_of_activations From inf_products a,inf_subscriber_all b,tmp_numbering_plan c
Where
a.product_id='S1122' And
to_char(a.create_date,'yyyymm')='200809' And
a.sub_id=b.sub_id And
substr(b.imsi,1,7)=c.imsi_range
Group By c.city
Order By no_of_activations Desc;

Create Table TMP_NUMBERING_PLAN (IMSI_RANGE VARCHAR2(100),CITY VARCHAR2(100));
Select * From CCARE.TMP_NUMBERING_PLAN For Update;
64 changes: 64 additions & 0 deletions OracleSQLScripts/Generate_Trunk_Reports.sql
@@ -0,0 +1,64 @@
Select * From Mapping_Def t Where t.mapping_id='194';
Select Distinct substr(t.mapping_dest,instr(t.Mapping_dest,',')+1) Partner_Type From mapping_list t Where t.mapping_id='194';-- Trunk Type (0 --> Trunk IN , 1 --> TrunkOut);
Select * From mapping_list t Where t.mapping_id='194';-- Trunk Type (0 --> Trunk IN , 1 --> TrunkOut);
-- Services: SV301 --> IDD Partner , SV203 --> Interconnect Partner
Select substr(mapping_sour,18) From Mapping_List t;

Select to_char(substr(t.mapping_sour,(instr(t.mapping_sour,',',1,2) + 1),1)) From prm.Mapping_List t Where t.mapping_id='194'; -- to get the trunk type
Select (((instr(t.mapping_sour,',',1,2)) - (instr(t.Mapping_Sour,',',1,1))) - 1) From prm.Mapping_List t Where t.mapping_id='194'; -- to get the length of the switch field
Select substr(t.Mapping_Sour,instr(t.mapping_sour,',')+1,(((instr(t.mapping_sour,',',1,2)) - (instr(t.Mapping_Sour,',',1,1))) - 1)) switch_code From prm.Mapping_List t Where t.mapping_id='194'; -- to get the switch code
Select substr(t.mapping_dest,1,INSTR(t.mapping_dest,',') -1) Trunk_Manager From prm.Mapping_List t Where t.mapping_id='194'; -- to get the trunk manager name
Select substr(t.mapping_sour,instr(t.mapping_sour,',',1,3)+1) Trunk_No From prm.Mapping_List t Where t.mapping_id='194'; -- to get the trunk manager


Select instr('JM001,7701144102,0,150',',',1,2) from dual;

-- TrunkIN Report SQL
Create Or Replace View BS_Trunk_Info As
Select
u.memo Switch_name,
substr(t.Mapping_Sour,instr(t.mapping_sour,',')+1,(((instr(t.mapping_sour,',',1,2)) - (instr(t.Mapping_Sour,',',1,1))) - 1)) switch_code,
decode(to_char(substr(t.mapping_sour,(instr(t.mapping_sour,',',1,2) + 1),1)),0,'Trunk IN',1,'Trunk Out') trunk_type,
substr(t.mapping_sour,instr(t.mapping_sour,',',1,3)+1) Trunk_No,
substr(t.mapping_dest,1,INSTR(t.mapping_dest,',') -1) Trunk_Manager,
decode(substr(t.mapping_dest,instr(t.Mapping_dest,',')+1),'SV301','IDD Partner','SV203','Interconnect Partner') Partner_Type
From mapping_list t,bill_comprehensive_info u
Where
t.mapping_id='194' And
substr(t.Mapping_Sour,instr(t.mapping_sour,',')+1,(((instr(t.mapping_sour,',',1,2)) - (instr(t.Mapping_Sour,',',1,1))) - 1))=u.post_billflag;
--to_char(substr(t.mapping_sour,(instr(t.mapping_sour,',',1,2) + 1),1))='0';

Select * From BS_Trunk_Info t Where (t.Partner_Type='Interconnect Partner' Or t.Trunk_Manager='ITPC') And t.trunk_type='Trunk IN';
select t.post_billflag,t.memo from bill_comprehensive_info t;
Create Table tmp_bs_swicth_info As select t.post_billflag,t.memo from bill_comprehensive_info t;
Select * From prm.tmp_bs_swicth_info t;

Select Distinct v.Trunk_Manager From prm.bs_trunk_info v;

Create Or Replace View BS_Trunk_Info As
Select
u.memo Switch_name,
substr(t.Mapping_Sour,instr(t.mapping_sour,',')+1,(((instr(t.mapping_sour,',',1,2)) - (instr(t.Mapping_Sour,',',1,1))) - 1)) switch_code,
decode(to_char(substr(t.mapping_sour,(instr(t.mapping_sour,',',1,2) + 1),1)),0,'Trunk IN',1,'Trunk Out') trunk_type,
substr(t.mapping_sour,instr(t.mapping_sour,',',1,3)+1) Trunk_No,
decode (substr(t.mapping_dest,1,INSTR(t.mapping_dest,',') -1),
'DECOV','DISCOVERY TEL',
'EDJV','ARIA PHONE',
'GLOBE','GLOBECOMM',
'INCLA','INCLARITY',
'IRQAT','ZAIN ATHEER',
'IRQOR','ZAIN IRAQNA',
'IRQKK','KOREK',
'IRQTEL','IRAQTEL',
'ITPC','ITPC',
'KURDT','KURD TEL',
'MEWLL','MEDIA TEL',
'MOBIT','MOBITEL',
'Noro','NAWROZ TEL',
'Vital','MAWTINY'
) Trunk_Manager,
decode(substr(t.mapping_dest,instr(t.Mapping_dest,',')+1),'SV301','IDD Partner','SV203','Interconnect Partner') Partner_Type
From mapping_list t,bill_comprehensive_info u
Where
t.mapping_id='194' And
substr(t.Mapping_Sour,instr(t.mapping_sour,',')+1,(((instr(t.mapping_sour,',',1,2)) - (instr(t.Mapping_Sour,',',1,1))) - 1))=u.post_billflag;

0 comments on commit 142f575

Please sign in to comment.