| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK" |
|---|
| 4 | ORACLE_HOME=/oracle/product/10.2.0 |
|---|
| 5 | ORACLE_SID=v880 |
|---|
| 6 | ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data |
|---|
| 7 | PATH=/usr/ccs/bin:/usr/bin:/usr/local/bin:/usr/sbin:/usr/ucb:/etc:$ORACLE_HOME/bin:. |
|---|
| 8 | export NLS_LANG |
|---|
| 9 | export ORACLE_HOME |
|---|
| 10 | export ORACLE_SID |
|---|
| 11 | export ORA_NLS33 |
|---|
| 12 | export PATH |
|---|
| 13 | |
|---|
| 14 | cd /data/oracle/crontab/app |
|---|
| 15 | |
|---|
| 16 | sqlplus "/ as sysdba " <<EOF |
|---|
| 17 | alter session set current_schema=cyp_nw_app; |
|---|
| 18 | |
|---|
| 19 | update pdl_product_base set EMALL_OWNED=0 where create_date>sysdate-700; |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | commit; |
|---|
| 23 | |
|---|
| 24 | update pdl_product_base p1 set EMALL_OWNED=1 where
|
|---|
| 25 | exists (select 1 from (select t1.product_id
|
|---|
| 26 | from ent_product_item t1, ent_user t2, ent_company t6
|
|---|
| 27 | where t1.user_id = t2.id and t1.user_id = t6.id
|
|---|
| 28 | and t1.sell_status = 1 and t1.start_date <= sysdate
|
|---|
| 29 | and sysdate <= t1.end_date and t1.status in (0,1)
|
|---|
| 30 | and t2.status = 1 and t6.status = 1 ) p2 where p1.id=p2.product_id); |
|---|
| 31 | |
|---|
| 32 | commit; |
|---|
| 33 | |
|---|
| 34 | update pdl_product a set a.EYP_PRICE_COUNT=0; |
|---|
| 35 | |
|---|
| 36 | update pdl_product a set a.EYP_PRICE_COUNT=(select b.company_count from ( |
|---|
| 37 | SELECT product_id, count(*) as company_count |
|---|
| 38 | FROM V_ENT_PRODUCT |
|---|
| 39 | group by product_id) b where b.product_id= a.id) |
|---|
| 40 | where exists (select 1 from v_ent_product c where a.id=c.product_id); |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | commit ; |
|---|
| 44 | |
|---|
| 45 | update ent_product_item set price_status=1 where company_product_id in
|
|---|
| 46 | (select t1.company_product_id from ent_product_item t1,v_pdl_product t2
|
|---|
| 47 | where t1.product_id=t2.id
|
|---|
| 48 | and t2.price<>0 and (t1.RETAIL_PRICE>t2.price*1.4 or t1. RETAIL_PRICE<t2.price*0.6) and t1.price_status=0); |
|---|
| 49 | |
|---|
| 50 | commit; |
|---|
| 51 | |
|---|
| 52 | truncate table product_app.eml_price; |
|---|
| 53 | |
|---|
| 54 | insert into eml_price(product_id,min_price,max_price) |
|---|
| 55 | (SELECT product_id, min(retail_price),max(retail_price) |
|---|
| 56 | FROM V_ENT_PRODUCT where price_status=0 |
|---|
| 57 | group by product_id); |
|---|
| 58 | |
|---|
| 59 | commit; |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | EOF |
|---|