period
NUMBER(6) default 0 not null,
pk_member NUMBER(20) not null,
pk_parent NUMBER(20) not null,
pk_place_parent NUMBER(20),
place_dept NUMBER(2),
member_code VARCHAR2(30) not null,
member_name VARCHAR2(100) not null,
customer_type NUMBER(2) not null,
phone VARCHAR2(40) not null,
pk_grade NUMBER(4) not null,
pk_awards NUMBER(4) not null,
account_status number(1) default 0 not null,
pay_status NUMBER(2) default 0 not null,
register_authority number(2) default 0 not null,
category number(2) default 0 not null,
purchase_type number(2) default 0 not null,
purchase_status number(2) default 0 not null,
share_status number(2) default 0 not null,
income_status number(2) default 0 not null,
pk_team_code number(20),
pk_center_code number(20),
pk_vertex number(20),
pk_settle_country number(4) not null,
is_real_name NUMBER(1) default 1 not null,
is_bus_license NUMBER(1) default 1 not null,
is_maker_space NUMBER(1) default 1 not null,
pk_country number(4) default 1 not null
,
,
pk_rate
NUMBER(6) ,
a_balance NUMBER(17,6) default 0 not null,
b_balance NUMBER(17,6) default 0 not null,
a_sum_amount NUMBER(17,6) default 0 not null,
b_sum_amount NUMBER(17,6) default 0 not null,
a_sum_pv NUMBER(17,6) default 0 not null,
b_sum_pv NUMBER(17,6) default 0 not null,
a_new_amount NUMBER(17,6) default 0 not null,
b_new_amount NUMBER(17,6) default 0 not null,
a_new_pv NUMBER(17,6) default 0 not null,
b_new_pv NUMBER(17,6) default 0 not null,
a_sum_real_amount NUMBER(17,6) default 0 not null,
b_sum_real_amount NUMBER(17,6) default 0 not null,
a_sum_real_pv NUMBER(17,6) default 0 not null,
b_sum_real_pv NUMBER(17,6) default 0 not null,
rep_a_balance NUMBER(17,6) default 0 not null,
rep_b_balance NUMBER(17,6) default 0 not null,
rep_a_new_amount NUMBER(17,6) default 0 not null,
rep_b_new_amount NUMBER(17,6) default 0 not null,
rep_a_new_pv NUMBER(17,6) default 0 not null,
rep_b_new_pv NUMBER(17,6) default 0 not null,
rep_a_sum_amount NUMBER(17,6) default 0 not null,
rep_b_sum_amount NUMBER(17,6) default 0 not null,
rep_a_sum_pv NUMBER(17,6) default 0 not null,
rep_b_sum_pv NUMBER(17,6) default 0 not null,
register_amount NUMBER(17,6) default 0 not null,
register_pv NUMBER(17,6) default 0 not null,
register_new_amount NUMBER(17,6) default 0 not null,
register_new_pv NUMBER(17,6) default 0 not null,
upgrade_amount NUMBER(17,6) default 0 not null,
upgrade_pv NUMBER(17,6) default 0 not null,
upgrade_new_amount NUMBER(17,6) default 0 not null,
upgrade_new_pv NUMBER(17,6) default 0 not null,
repurchase_amount NUMBER(17,6) default 0 not null,
repurchase_pv NUMBER(17,6) default 0 not null,
repurchase_new_amount NUMBER(17,6) default 0 not null,
repurchase_new_pv NUMBER(17,6) default 0 not null,
hi_fun_amount NUMBER(17,6) default 0 not null,
hi_fun_pv NUMBER(17,6) default 0 not null,
hi_fun_new_amount NUMBER(17,6) default 0 not null,
hi_fun_new_pv NUMBER(17,6) default 0 not null,
mall_amount NUMBER(17,6) default 0 not null,
mall_pv NUMBER(17,6) default 0 not null,
mall_new_amount NUMBER(17,6) default 0 not null,
mall_new_pv NUMBER(17,6) default 0 not null,
REGISTER_Blo_NEW_PV NUMBER(17,6) default 0 not null,
UPGRADE_Blo_NEW_PV NUMBER(17,6) default 0 not null,
REPURCHASE_Blo_NEW_PV NUMBER(17,6) default 0 not null,
HI_FUN_Blo_NEW_PV NUMBER(17,6) default 0 not null,
MALL_Blo_NEW_PV NUMBER(17,6) default 0 not null,
min_achieve number(17,6) default 0 not null,
round NUMBER(6) default 0 not null,
second NUMBER(4) default 1 not null
r_a_balance
NUMBER(17,6) default 0 not null,
r_b_balance NUMBER(17,6) default 0 not null,
r_a_sum_amount NUMBER(17,6) default 0 not null,
r_b_sum_amount NUMBER(17,6) default 0 not null,
r_a_sum_pv NUMBER(17,6) default 0 not null,
r_b_sum_pv NUMBER(17,6) default 0 not null,
r_a_sum_real_amount NUMBER(17,6) default 0 not null,
r_b_sum_real_amount NUMBER(17,6) default 0 not null,
r_a_sum_real_pv NUMBER(17,6) default 0 not null,
r_b_sum_real_pv NUMBER(17,6) default 0 not null,
r_rep_a_balance NUMBER(17,6) default 0 not null,
r_rep_b_balance NUMBER(17,6) default 0 not null,
r_rep_a_sum_amount NUMBER(17,6) default 0 not null,
r_rep_b_sum_amount NUMBER(17,6) default 0 not null,
r_rep_a_sum_pv NUMBER(17,6) default 0 not null,
r_rep_b_sum_pv NUMBER(17,6) default 0 not null
CREATE
OR REPLACE TRIGGER
${tableName}
_
TRIG
BEFORE
INSERT
OR
UPDATE ON ${tableName}
FOR EACH ROW
DECLARE
v_newVal NUMBER(12) := 0;
v_incval
NUMBER(12) := 0;
BEGIN
IF
INSERTING AND :new.pk_id IS NULL THEN
SELECT ${tableNameSeq}.NEXTVAL
INTO v_newVal
FROM DUAL;
IF
v_newVal = 1 THEN
SELECT NVL(max(pk_id), 0)
INTO v_newVal
FROM ${tableName};
v_newVal
:= v_newVal + 1;
LOOP
EXIT WHEN v_incval >= v_newVal;
SELECT ${tableNameSeq}.nextval
INTO v_incval
FROM dual;
END LOOP;
END IF;
:new
.pk_id := v_newVal;
END IF;
END;
select pk_member,pk_parent,member_code,member_name,pk_awards,account_status,
register_authority,customer_type,income_status,pk_settle_country,purchase_status,share_status,is_maker_space,
a_balance,b_balance,r_a_balance,r_b_balance,rep_a_balance,rep_b_balance,r_rep_a_balance,r_rep_b_balance,
register_amount,register_pv,upgrade_amount,upgrade_pv,repurchase_amount,pk_center_code,
repurchase_pv,hi_fun_amount,hi_fun_pv,mall_amount,mall_pv,category,pk_grade,
min_achieve,round,second
from ${settleTableName}
where pay_status = 1
start with pk_member = #{item}
connect by pk_member = prior pk_parent