123131

SELECT      edr_comm_prem*1.0 as 手续费,
            EDR_PERFORMANCE_ACTUAL_FEE*1.0 AS 复核绩效,
            EDR_FULLPERFORMANCE_FEE*1.0 AS 全绩效,
           EDR_APPROVABLE_ELSE_CHARGE_FEE*1.0 AS 日展费
  FROM (SELECT TRUNC(GREATEST(A.INSURANCE_BEGIN_TIME, A.UNDERWRITE_TIME)) AS STAT_YM,
               A.DEPARTMENT_CODE AS DEPARTMENT_CODE,
               A.PLAN_CODE AS PLAN_CODE,
               A.BUSINESS_TYPE AS BUSINESS_TYPE,
               A.BUSINESS_SOURCE_CODE AS BUSINESS_SOURCE_CODE,
               A.BUSINESS_SOURCE_DETAIL_CODE AS BUSINESS_SOURCE_DETAIL_CODE,
               A.BUSINESS_SOURCE_CODE || A.BUSINESS_SOURCE_DETAIL_CODE ||
               A.CHANNEL_SOURCE_CODE ||
               DECODE(A.CHANNEL_SOURCE_DETAIL_CODE,
                      ‘ ‘,
                      ‘0‘,
                      NVL(A.CHANNEL_SOURCE_DETAIL_CODE, ‘0‘)) AS THREE,
               A.BUSINESS_SOURCE_CODE || A.BUSINESS_SOURCE_DETAIL_CODE ||
               A.CHANNEL_SOURCE_CODE ||
               DECODE(A.CHANNEL_SOURCE_DETAIL_CODE,
                      ‘ ‘,
                      ‘0‘,
                      NVL(A.CHANNEL_SOURCE_DETAIL_CODE, ‘0‘)) AS FIVE,
               A.BUSINESS_SOURCE_CODE || A.BUSINESS_SOURCE_DETAIL_CODE ||
               A.CHANNEL_SOURCE_CODE ||
               DECODE(A.CHANNEL_SOURCE_DETAIL_CODE,
                      ‘ ‘,
                      ‘0‘,
                      NVL(A.CHANNEL_SOURCE_DETAIL_CODE, ‘0‘)) AS EIGHT,
               SUBSTRB(DECODE(A.PLAN_CODE,
                              ‘A00‘,
                              A.C_TGT1,
                              ‘A01‘,
                              A.C_TGT1,
                              ‘A02‘,
                              A.C_TGT1,
                              ‘A03‘,
                              A.C_TGT1,
                              ‘A15‘,
                              A.C_TGT8,
                              ‘A19‘,
                              (DECODE(A.DATA_SOURCE, ‘E‘, A.C_TGT9, A.C_TGT5)),
                              ‘A37‘,
                              (DECODE(A.DATA_SOURCE, ‘E‘, A.C_TGT13, A.C_TGT1)),
                              ‘A39‘,
                              A.C_TGT8,
                              ‘无‘),
                       1,
                       50) AS PROPERTY_TRADE,
               SUBSTRB(DECODE(A.PLAN_CODE,
                              ‘A33‘,
                              A.C_TGT8,
                              ‘A04‘,
                              A.C_TGT12,
                              ‘A32‘,
                              A.C_TGT12,
                              ‘无‘),
                       1,
                       50) AS MACHINE_TRADE3,
               SUBSTRB(DECODE(A.PLAN_CODE,
                              ‘A13‘,
                              NVL(A.C_TGT19, A.C_TGT18),
                              ‘A14‘,
                              NVL(A.C_TGT19, A.C_TGT18),
                              ‘无‘),
                       1,
                       50) AS BUILDING_TYPE3,
               SUBSTRB(DECODE(B.INSURANCE_SECT, ‘B‘, A.C_TGT1, ‘无‘), 1, 50) AS CARGO_TYPE,
               A.PERFORMANCE_LEVEL AS PERFORMANCE_LEVEL,
               DECODE(A.C_EDR_TYP,
                      ‘1‘,
                      DECODE(SIGN(A.N_PRM_VAR - 0), -1, 1, 0),
                      0) AS EDR_MINUS_NUM, --批减笔数
               DECODE(A.C_EDR_TYP,
                      ‘1‘,
                      DECODE(SIGN(A.N_PRM_VAR - 0),
                             -1,
                             A.N_PRM_VAR * C.N_CHG_RTE,
                             0),
                      0) AS EDR_MINUS_PREM, --批减保费
               DECODE(A.C_EDR_TYP, ‘2‘, -1, ‘8‘, 1, ‘0‘) AS ZT_NUM, --注退件数
               A.N_PRM_VAR * C.N_CHG_RTE AS EDR_PREM,
               A.CEDING_TYPE_CODE AS CEDING_TYPE_CODE,
               A.LAST_POLICY_NO AS LAST_POLICY_NO,
               A.PARENT_COMPANY_CODE AS PARENT_COMPANY_CODE,
               A.XMLB_MARK,
               CASE
                 WHEN B.INSURANCE_SECT = ‘A‘ AND
                      A.PLAN_CODE NOT IN (‘A04‘, ‘A32‘, ‘A33‘) AND
                      A.PERFORMANCE_LEVEL = ‘鼓励承保业务‘ THEN
                  ‘1‘
                 WHEN B.INSURANCE_SECT = ‘A‘ AND
                      A.PLAN_CODE NOT IN (‘A04‘, ‘A32‘, ‘A33‘) AND
                      A.PERFORMANCE_LEVEL IN (‘谨慎承保业务‘, ‘一般承保业务‘) AND
                      TRIM(A.XMLB_MARK) IN (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘) AND
                      A.PARENT_COMPANY_CODE IS NOT NULL THEN
                  ‘1‘
                 WHEN A.PLAN_CODE IN (‘A04‘, ‘A32‘, ‘A33‘) AND
                      A.PERFORMANCE_LEVEL IN (‘鼓励承保业务‘, ‘一般承保业务‘) THEN
                  ‘1‘
                 WHEN B.INSURANCE_SECT = ‘E‘ AND
                      A.PERFORMANCE_LEVEL IN (‘鼓励承保业务‘, ‘一般承保业务‘) THEN
                  ‘1‘
                 WHEN B.INSURANCE_SECT = ‘B‘ THEN
                  ‘1‘
                 WHEN B.INSURANCE_SECT = ‘D‘ THEN
                  ‘1‘
                 WHEN B.INSURANCE_SECT = ‘H‘ AND A.PLAN_CODE <> ‘A56‘ THEN
                  ‘1‘
                 WHEN B.INSURANCE_SECT = ‘I‘ THEN
                  ‘1‘
                 ELSE
                  ‘0‘
               END AS IS_HIGHQUALITY,
               T.EDR_COMM_PREM * C.N_CHG_RTE AS EDR_COMM_PREM,
               T.EDR_CHANGEFEE_FEE * C.N_CHG_RTE AS EDR_CHANGEFEE_FEE,
               T.EDR_PERFORMANCE_ACTUAL_FEE * C.N_CHG_RTE AS EDR_PERFORMANCE_ACTUAL_FEE,
               T.EDR_TRANSFORMFEE_FEE * C.N_CHG_RTE AS EDR_TRANSFORMFEE_FEE,
               T.EDR_FULLPERFORMANCE_FEE * C.N_CHG_RTE AS EDR_FULLPERFORMANCE_FEE,
               T.EDR_APPROVABLE_ELSE_CHARGE_FEE * C.N_CHG_RTE AS EDR_APPROVABLE_ELSE_CHARGE_FEE,
               T.EDR_APP_ELSE_CHARGE_FEE2 * C.N_CHG_RTE AS EDR_APP_ELSE_CHARGE_FEE2,
               SUBSTRB(DECODE(A.PLAN_CODE, ‘B04‘, A.C_TGT6, NULL), 1, 10) BUILDYEAR,
               (CASE
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 IS NULL THEN
                  ‘909‘
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 > -1 AND
                      A.N_NUMBER9 <= 200 THEN
                  ‘900‘
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 > 200 AND
                      A.N_NUMBER9 <= 500 THEN
                  ‘901‘
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 > 500 AND
                      A.N_NUMBER9 <= 1000 THEN
                  ‘902‘
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 > 1000 AND
                      A.N_NUMBER9 <= 3000 THEN
                  ‘903‘
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 > 3000 AND
                      A.N_NUMBER9 <= 5000 THEN
                  ‘904‘
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 > 5000 AND
                      A.N_NUMBER9 <= 10000 THEN
                  ‘905‘
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 > 10000 AND
                      A.N_NUMBER9 <= 20000 THEN
                  ‘906‘
                 WHEN A.PLAN_CODE = ‘B04‘ AND A.N_NUMBER9 > 20000 THEN
                  ‘907‘
               END) AS TOTALTON,
               SUBSTRB(DECODE(A.PLAN_CODE, ‘B04‘, A.C_TGT13, NULL), 1, 10) AS SHIPPINGTYPE,
               A.BUSI_TYPE,
               DECODE(LENGTH(A.INPUT_BY),
                      LENGTH(REPLACE(A.INPUT_BY, ‘-‘)),
                      1,
                      0) INOUTSIDE_TYPE,
               T.AGREEMENT_TYPE,
               A.AGENT_CODE,
               A.BROKER_CODE,
               A.PRODUCT_CODE,
               A.COINSURANCE_MARK,
               A.N_AMT_VAR * D.N_CHG_RTE AS TOTAL_INSURED_AMOUNT,
               TO_CHAR(CASE
                         WHEN E.INSURANCE_COST_RATE IS NULL THEN
                          1200
                         WHEN E.INSURANCE_COST_RATE < 0 THEN
                          1201
                         ELSE
                          (SELECT T4.PREM
                             FROM EPCIS_NL_PREM_SEG_RIGHT T4
                            WHERE T4.FLAG = ‘C‘
                              AND ((E.INSURANCE_COST_RATE > T4.LOWER_LIMIT AND
                                  T4.UPPER_LIMIT IS NULL) OR
                                  (E.INSURANCE_COST_RATE > T4.LOWER_LIMIT AND
                                  E.INSURANCE_COST_RATE <= T4.UPPER_LIMIT)))
                       END) AS INSURANCE_COST_SEG
          FROM EPCIS_NL_ENDORSE A,
               EPCIS_NL_INSRNC B,
               EPCIS_NL_POLICY E,
               EPCIS_NL_T_CHG_RATE C,
               EPCIS_NL_T_CHG_RATE D,
               (SELECT A.POLICY_NO,
                       A.C_EDR_NO,
                       DECODE(A.SUB_OPENCOVER_NO, NULL, 0, 1) AGREEMENT_TYPE,
                       A.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A.COMMISSION_CHARGE_PROPORTION, 0) +
                       NVL(A.BROKER_CHARGE_PROPORTION, 0)) -
                       B.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B.COMMISSION_CHARGE_PROPORTION, 0) +
                       NVL(B.BROKER_CHARGE_PROPORTION, 0)) AS EDR_COMM_PREM,
                       A.TOTAL_ACTUAL_PREMIUM * (NVL(A.CHANGEFEE_RATE, 0)) -
                       B.TOTAL_ACTUAL_PREMIUM * (NVL(B.CHANGEFEE_RATE, 0)) AS EDR_CHANGEFEE_FEE,
                       A.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A.PERFORMANCE_ACTUAL_RATE, 0)) -
                       B.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B.PERFORMANCE_ACTUAL_RATE, 0)) AS EDR_PERFORMANCE_ACTUAL_FEE,
                       A.TOTAL_ACTUAL_PREMIUM * (NVL(A.TRANSFORMFEE_RATE, 0)) -
                       B.TOTAL_ACTUAL_PREMIUM * (NVL(B.TRANSFORMFEE_RATE, 0)) AS EDR_TRANSFORMFEE_FEE,
                       A.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A.FULLPERFORMANCE_RATE, 0)) -
                       B.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B.FULLPERFORMANCE_RATE, 0)) AS EDR_FULLPERFORMANCE_FEE,
                       A.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A.APPROVABLE_ELSE_CHARGE_RATE, 0)) -
                       B.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B.APPROVABLE_ELSE_CHARGE_RATE, 0)) AS EDR_APPROVABLE_ELSE_CHARGE_FEE,
                       A.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A.APPROVABLE_ELSE_CHARGE_RATE2, 0)) -
                       B.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B.APPROVABLE_ELSE_CHARGE_RATE2, 0)) AS EDR_APP_ELSE_CHARGE_FEE2
                  FROM EPCIS_NL_ENDORSE A, EPCIS_NL_ENDORSE B
                 WHERE A.POLICY_NO = B.POLICY_NO
                   AND A.ENDORSEMENT_TIMES = B.ENDORSEMENT_TIMES + 1
                   AND A.ENDORSEMENT_TIMES > 1
                UNION ALL
                SELECT A1.POLICY_NO,
                       A1.C_EDR_NO,
                       DECODE(B1.SUB_OPENCOVER_NO, NULL, 0, 1) AGREEMENT_TYPE,
                       A1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A1.COMMISSION_CHARGE_PROPORTION, 0) +
                       NVL(A1.BROKER_CHARGE_PROPORTION, 0)) -
                       B1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B1.COMMISSION_CHARGE_PROPORTION, 0) +
                       NVL(B1.BROKER_CHARGE_PROPORTION, 0)) AS EDR_COMM_PREM,
                       A1.TOTAL_ACTUAL_PREMIUM * (NVL(A1.CHANGEFEE_RATE, 0)) -
                       B1.TOTAL_ACTUAL_PREMIUM * (NVL(B1.CHANGEFEE_RATE, 0)) AS EDR_CHANGEFEE_FEE,
                       A1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A1.PERFORMANCE_ACTUAL_RATE, 0)) -
                       B1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B1.ORI_PERFORMANCE_ACTUAL_RATE, 0)) AS EDR_PERFORMANCE_ACTUAL_FEE,
                       A1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A1.TRANSFORMFEE_RATE, 0)) -
                       B1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B1.TRANSFORMFEE_RATE, 0)) AS EDR_TRANSFORMFEE_FEE,
                       A1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A1.FULLPERFORMANCE_RATE, 0)) -
                       B1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B1.FULLPERFORMANCE_RATE, 0)) AS EDR_FULLPERFORMANCE_FEE,
                       A1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A1.APPROVABLE_ELSE_CHARGE_RATE, 0)) -
                       B1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B1.ORI_APP_ELSE_CHARGE_RATE, 0)) AS EDR_APPROVABLE_ELSE_CHARGE_FEE,
                       A1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(A1.APPROVABLE_ELSE_CHARGE_RATE2, 0)) -
                       B1.TOTAL_ACTUAL_PREMIUM *
                       (NVL(B1.APPROVABLE_ELSE_CHARGE_RATE2, 0)) AS EDR_APP_ELSE_CHARGE_FEE2
                  FROM EPCIS_NL_ENDORSE A1, EPCIS_NL_POLICY B1
                 WHERE A1.POLICY_NO = B1.POLICY_NO
                   AND A1.ENDORSEMENT_TIMES = 1) T
         WHERE A.PREMIUM_CURRENCY_CODE = C.C_CUR_NO_1
           AND A.POLICY_NO = E.POLICY_NO
           /*and A.POLICY_NO in ( ‘11176001900151672980‘,‘11176001900176570979‘,‘11176001900234509691‘)*/
           AND GREATEST(A.INSURANCE_BEGIN_TIME, A.UNDERWRITE_TIME) <
               (NVL(C.T_EXPD_TM, TIMESTAMP ‘9999-12-31 23:59:59.999‘))
           AND GREATEST(A.INSURANCE_BEGIN_TIME, A.UNDERWRITE_TIME) >=
               C.T_EFFC_TM
           AND C.C_CUR_NO_2 = ‘01‘
           AND A.AMOUNT_CURRENCY_CODE = D.C_CUR_NO_1
           AND GREATEST(A.INSURANCE_BEGIN_TIME, A.UNDERWRITE_TIME) <
               (NVL(D.T_EXPD_TM, TIMESTAMP ‘9999-12-31 23:59:59.999‘))
           AND GREATEST(A.INSURANCE_BEGIN_TIME, A.UNDERWRITE_TIME) >=
               D.T_EFFC_TM
           AND D.C_CUR_NO_2 = ‘01‘
           AND A.PLAN_CODE = B.INSURANCE_CODE
           AND A.DEPARTMENT_CODE NOT LIKE ‘286%‘
           and A.DEPARTMENT_CODE =  ‘21176‘
           and A.plan_code in (‘A13‘, ‘A14‘)
           AND GREATEST(A.INSURANCE_BEGIN_TIME, A.UNDERWRITE_TIME) >=
               TO_DATE(‘20090101‘, ‘YYYYMMDD‘)
           AND TRUNC(GREATEST(A.INSURANCE_BEGIN_TIME, A.UNDERWRITE_TIME)) >=
               TO_DATE(‘20160413‘, ‘YYYYMMDD‘)
           AND TRUNC(GREATEST(A.INSURANCE_BEGIN_TIME, A.UNDERWRITE_TIME)) <
               TO_DATE(‘20160414‘, ‘YYYYMMDD‘)
           AND A.C_EDR_NO = T.C_EDR_NO(+))

时间: 2024-10-31 05:48:48

123131的相关文章

wiki-贝塞尔曲线

贝塞尔曲线 维基百科,自由的百科全书 三次方贝塞尔曲线 在数学的数值分析领域中,贝塞尔曲线, 又称贝赛尔曲线(Bézier曲线)是电脑图形学中相当重要的参数曲线.更高维度的广泛化贝塞尔曲线就称作贝塞尔曲面,其中贝塞尔三角是一种特殊的实例. 贝塞尔曲线于1962年,由法国工程师皮埃尔·贝塞尔(Pierre Bézier)所广泛发表,他运用贝塞尔曲线来为汽车的主体进行设计.贝塞尔曲线最初由Paul de Casteljau于1959年运用de Casteljau算法开发,以稳定数值的方法求出贝塞尔曲

C++ 中指针与引用的区别

指向不同类型的指针的区别在于指针类型可以知道编译器解释某个特定地址(指针指向的地址)中的内存内容及大小,而void*指针则只表示一个内存地址,编译器不能通过该指针所指向对象的类型和大小,因此想要通过void*指针操作对象必须进行类型转化.     ★ 相同点: 1. 都是地址的概念: 指针指向一块内存,它的内容是所指内存的地址: 引用是某块内存的别名.     ★ 区别: 1. 指针是一个实体,而引用仅是个别名: 2. 引用使用时无需解引用(*),指针需要解引用: 3. 引用只能在定义时被初始化

mongoDB2.6,java使用详解

本文使用的环境是:win7_64+Eclipse+maven 一.准备工作 下载java驱动包 驱动包下载地址:http://mvnrepository.com/artifact/org.mongodb/mongo-java-driver mongoDB下载:http://www.mongodb.org/ 在线api:http://docs.mongodb.org/manual/applications/drivers/ 二.安装Mongo 1.windows下安装方式: 安装Mongo数据库:

规范的空间里韩国李开复的就老客户

 http://bangumi.tv//blog/59988 http://bangumi.tv//blog/60011 http://bangumi.tv//blog/60072 http://bangumi.tv//blog/60108 http://bangumi.tv//blog/60201 http://bangumi.tv//blog/60231 http://bangumi.tv//blog/60315 http://bangumi.tv//blog/60412 http://

C 中 关于printf 函数中度剖析

题外话  这篇博文主要围绕printf函数分析的,主要讲解printf 使用C的可变参数机制, printf是否可重入(是否线程安全), printf函数的源码实现. 正文 1.C中可变参数机制 我们先举个例子,假如现在有这样一个需求 "需要一个不定参数整型求和函数". 具体实现代码如下 // 需要一个不定参数整型求和函数 int sum_add(int len, ...) { int sum = 0; va_list ap; va_start(ap, len); // 初始化 将ap

[转载]C++中引用与指针的区别(详细介绍)

本文转载自http://www.cnblogs.com/tracylee/archive/2012/12/04/2801519.html C++中的引用与指针的区别 指向不同类型的指针的区别在于指针类型可以知道编译器解释某个特定地址(指针指向的地址)中的内存内容及大小,而void*指针则只表示一个内存地址,编译器不能通过该指针所指向对象的类型和大小,因此想要通过void*指针操作对象必须进行类型转化.     ★ 相同点: 1. 都是地址的概念: 指针指向一块内存,它的内容是所指内存的地址: 引

引用与指针的区别【转】

本文转载自;http://blog.csdn.net/dujiangyan101/article/details/2844138 指针和引用的区别 (1)引用总是指向一个对象,没有所谓的 null reference .所有当有可能指向一个对象也由可能不指向对象则必须使用 指针. 由于C++ 要求 reference 总是指向一个对象所以 reference要求有初值. String & rs = string1; 由于没有所谓的 null reference 所以所以在使用前不需要进行测试其是

c++引用和指针的彻底理解

 ★ 相同点: 1. 都是地址的概念: 指针指向一块内存,它的内容是所指内存的地址:引用是某块内存的别名.  ★ 区别: 1. 指针是一个实体,而引用仅是个别名: 2. 引用使用时无需解引用(*),指针需要解引用: 3. 引用只能在定义时被初始化一次,之后不可变:指针可变: 引用"从一而终" ^_^ 4. 引用没有 const,指针有 const,const 的指针不可变: 5. 引用不能为空,指针可以为空: 6. "sizeof 引用"得到的是所指向的变量(对象)

指针和引用的区别(c/c++)

http://blog.csdn.net/thisispan/article/details/7456169 ★ 相同点: 1. 都是地址的概念: 指针指向一块内存,它的内容是所指内存的地址:引用是某块内存的别名.  ★ 区别: 1. 指针是一个实体,而引用仅是个别名: 2. 引用使用时无需解引用(*),指针需要解引用: 3. 引用只能在定义时被初始化一次,之后不可变:指针可变: 引用"从一而终" ^_^ 4. 引用没有 const,指针有 const,const 的指针不可变: 5.