------------------------------------------------
create table DEP_WRTF_RSLT
(
sr_no_id NUMBER(28) not null,
dl_cd VARCHAR2(50) not null,
prdct_cd VARCHAR2(50),
acmltd_wrtf_ratio NUMBER(20,10),
exstng_st VARCHAR2(8),
wrtf_dt DATE,
wrtf_mthd VARCHAR2(8),
nr_leg_base_rmn_amnt NUMBER(30,10),
rmng_fr_leg_base_dl_amnt NUMBER(30,10),
nr_leg_rsk_rmn_amnt NUMBER(30,10),
fr_leg_rsk_rmn_amnt NUMBER(30,10),
nr_leg_cny_rmn_amnt NUMBER(30,10),
nr_leg_term_rmn_amnt NUMBER(30,10),
fleg_cny_rmn_amnt NUMBER(30,10),
rmng_fr_leg_term_dl_amnt NUMBER(30,10),
crtr VARCHAR2(100),
crt_tm TIMESTAMP(6),
updtr VARCHAR2(100),
upd_tm TIMESTAMP(6)
);
------------------------------------------------
create sequence SEQ_FRGN_CCY_IMPLD_IR_CRV_PRC minvalue 1 maxvalue 9999999999999999999999999999 start with 1 increment by 1 cache 20; create table unique_test (id number, fname varchar2(20), lname varchar2(20), address varchar2(100), email varchar2(40), constraint name_unique unique(fname,lname))
创建表unique_test并将fname,lname联合起来作唯一主键
ALTER TABLE FX_OPTN_IMPLD_VLTLTY_CRV_PRCNG ADD CONSTRAINT XPKFX_OPTN_IMPLD_PRCNG PRIMARY KEY (SR_NO_ID);
alter table FX_DL_DTL add constraint UN_FX_DL_DTL unique (DL_CD);
--------------------------------------------------------
--初始化规则:
--数据范围:远端起息日大于当前日期,并且存续状态字段为空的外汇掉期交易
--存续状态:初始化为有效;若交易已应急删除,初始化为撤销;
--累计冲销比例:初始化设置为0.00;
--近端留存金额:初始化设置为近端基准货币金额;
--远端留存金额:初始化设置为远端基准货币金额;
--未删除的交易
INSERT INTO TSDEAL.WRTF_RSLT_INFO
(SR_NO_ID,
DL_CD,
PRDCT_CD,
ACMLTD_WRTF_RATIO,
EXSTNG_ST,
NR_LEG_BASE_RMN_AMNT,
NR_LEG_TERM_RMN_AMNT,
RMNG_FR_LEG_BASE_DL_AMNT,
RMNG_FR_LEG_TERM_DL_AMNT,
NR_LEG_RSK_RMN_AMNT,
FR_LEG_RSK_RMN_AMNT,
CRTR,
CRT_TM)
SELECT TSDEAL.SEQ_WRTF_RSLT_INFO.NEXTVAL,
A.DL_CD,
A.PRDCT_CD,
0,
'',
A.NR_LEG_BASE_AMNT,
A.NR_LEG_TERM_AMNT,
A.FR_LEG_BASE_AMNT,
A.FR_LEG_TERM_AMNT,
A.NR_LEG_RSK_AMNT,
A.FR_LEG_RSK_AMNT,
'ts-u-dealcommon',
SYSDATE
FROM TSDEAL.FX_DL_DTL_HSTRY A
WHERE A.DL_ST IN ('', '')
AND A.FR_LEG_VL_DT > TRUNC(SYSDATE)
AND A.PRDCT_CD = 'FXSWP'
AND NOT EXISTS
(SELECT 1 FROM TSDEAL.WRTF_RSLT_INFO B WHERE A.DL_CD = B.DL_CD);
---------------------------------------------------------------------------
INSERT INTO TSDEAL.WRTF_RSLT_INFO
(SR_NO_ID,
DL_CD,
PRDCT_CD,
ACMLTD_WRTF_RATIO,
EXSTNG_ST,
NR_LEG_BASE_RMN_AMNT,
NR_LEG_TERM_RMN_AMNT,
RMNG_FR_LEG_BASE_DL_AMNT,
RMNG_FR_LEG_TERM_DL_AMNT,
NR_LEG_RSK_RMN_AMNT,
FR_LEG_RSK_RMN_AMNT,
CRTR,
CRT_TM,
UPDTR,
UPD_TM)
SELECT TSDEAL.SEQ_WRTF_RSLT_INFO.NEXTVAL,
DL_CD,
PRDCT_CD,
ACMLTD_WRTF_RATIO,
EXSTNG_ST,
NR_LEG_BASE_RMN_AMNT,
NR_LEG_TERM_RMN_AMNT,
RMNG_FR_LEG_BASE_DL_AMNT,
RMNG_FR_LEG_TERM_DL_AMNT,
NR_LEG_RSK_RMN_AMNT,
FR_LEG_RSK_RMN_AMNT,
CRTR,
CRT_TM,
UPDTR,
UPD_TM
FROM TSDEAL.DEP_WRTF_RSLT T
WHERE T.WRTF_DT <= TRUNC(TO_DATE('2018-06-30','yyyy-MM-dd'));
-------------------------------------------------------------------------------- ***********************************************************************************
DECLARE
BEGIN
FOR A IN(SELECT USR_CD,INSTN_CD FROM TSDEV.USR_WDGT WHERE WDGT_ID = '')
LOOP
INSERT INTO TSDEV.USR_WDGT (PRVLG_ID, USR_CD, WDGT_ID, CRT_TM, CRTR, UPD_TM, UPDTR, WDGT_SHOW_TP, INSTN_CD) VALUES (TSDEV.SEQ_USR_WDGT.NEXTVAL, A.USR_CD, '', SYSDATE, 'TS', SYSDATE, 'TS', '', A.INSTN_CD);
INSERT INTO TSDEV.USR_WDGT (PRVLG_ID, USR_CD, WDGT_ID, CRT_TM, CRTR, UPD_TM, UPDTR, WDGT_SHOW_TP, INSTN_CD) VALUES (TSDEV.SEQ_USR_WDGT.NEXTVAL, A.USR_CD, '', SYSDATE, 'TS', SYSDATE, 'TS', '', A.INSTN_CD);
INSERT INTO TSDEV.USR_WDGT (PRVLG_ID, USR_CD, WDGT_ID, CRT_TM, CRTR, UPD_TM, UPDTR, WDGT_SHOW_TP, INSTN_CD) VALUES (TSDEV.SEQ_USR_WDGT.NEXTVAL, A.USR_CD, '', SYSDATE, 'TS', SYSDATE, 'TS', '', A.INSTN_CD);
END LOOP;
COMMIT;
END;
-----------------------------------------------------------------------------------
DECLARE
BEGIN
FOR A IN (
SELECT T.USR_CD AS USR_CD,T.INSTN_CD AS INSTN_CD FROM TSDEV.USR_INFO T WHERE T.USR_TP = ''
) LOOP
DELETE FROM TSDEV.USR_WDGT U WHERE U.USR_CD = A.USR_CD AND U.INSTN_CD = A.INSTN_CD AND U.WDGT_ID = '';
INSERT INTO TSDEV.USR_WDGT (PRVLG_ID, USR_CD, WDGT_ID, CRT_TM, CRTR, UPD_TM, UPDTR, WDGT_SHOW_TP, INSTN_CD) VALUES (TSDEV.SEQ_USR_WDGT.NEXTVAL, A.USR_CD, '', SYSDATE, 'TS', SYSDATE, 'TS', '', A.INSTN_CD);
END LOOP;
COMMIT;
END;
*********************************************************************************** $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$业务sql$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ SELECT tm,
agt,
prd,
swapPnt,
nrPrd,
nrPrice,
nrVol,
frPrd,
frPrice,
frVol,
CASE
WHEN QTNG_INSTN_CD = '' OR QT_INSTN_AGNCY_INSTN_CD = '' THEN
DECODE(tkrDir, 'B', 'S', 'S', 'B', tkrDir)
ELSE
tkrDir
END AS tkrDir,
CASE
WHEN QTNG_INSTN_CD = '' OR QT_INSTN_AGNCY_INSTN_CD = '' THEN
DECODE(nrDir, 'B', 'S', 'S', 'B', nrDir)
ELSE
nrDir
END AS nrDir,
CASE
WHEN QTNG_INSTN_CD = '' OR QT_INSTN_AGNCY_INSTN_CD = '' THEN
DECODE(frDir, 'B', 'S', 'S', 'B', frDir)
ELSE
frDir
END AS frDir FROM (SELECT T.DL_TM + 0 AS TM,
T.PRD AS prd,
T.SWAP_PNT AS swapPnt,
T.TKR_DIR AS tkrDir,
T.NR_LEG_TERM AS nrPrd,
T.NLEG_FWD_PNT AS nrPrice,
T.INTR_NLEG_BASE_CCY_TRDNG_DIR AS nrDir,
T.NR_LEG_RSK_AMNT AS nrVol,
T.FR_LEG_TERM AS frPrd,
T.FLEG_FWD_PNT AS frPrice,
T.INTR_FLEG_BASE_CCY_DIR AS frDir,
T.FR_LEG_RSK_AMNT AS frVol,
T.QTNG_INSTN_CD,
T.QT_INSTN_AGNCY_INSTN_CD,
'N' AS AGT
FROM TSDEAL.GLD_DL_DTL T
WHERE T.DT_CNFRM = TO_DATE('2018-07-19', 'yyyy-MM-dd')
AND T.PRDCT_CD = ''
AND T.PRD = ''
AND T.CCY_PAIR_CD = ''
AND T.TRDNG_MD_CD = 'ODM'
AND T.TRDNG_MTHD_CD = 'Matching'
AND trunc(T.DL_TM, 'mi') =
to_date('2019-07-19', 'YYYY-MM-DD HH24:MI')
--AND (
AND T.DL_ST <> ''
UNION ALL
SELECT T.DL_TM + 0 AS TM,
T.PRD AS prd,
T.SWAP_PNT AS swapPnt,
T.TKR_DIR AS tkrDir,
T.NR_LEG_TERM AS nrPrd,
T.NLEG_FWD_PNT AS nrPrice,
T.INTR_NLEG_BASE_CCY_TRDNG_DIR AS nrDir,
T.NR_LEG_RSK_AMNT AS nrVol,
T.FR_LEG_TERM AS frPrd,
T.FLEG_FWD_PNT AS frPrice,
T.INTR_FLEG_BASE_CCY_DIR AS frDir,
T.FR_LEG_RSK_AMNT AS frVol, T.QTNG_INSTN_CD,
T.QT_INSTN_AGNCY_INSTN_CD,
'N' AS AGT
FROM TSDEAL.GLD_DL_DTL_HSTRY T
WHERE T.DT_CNFRM = TO_DATE('2018-07-19', 'yyyy-MM-dd')
AND T.PRDCT_CD = ''
AND T.PRD = ''
AND T.CCY_PAIR_CD = ''
AND T.TRDNG_MD_CD = 'QDM'
AND T.FLR_TP = 'Bilateral'
AND trunc(T.DL_TM, 'mi') =
to_date('2018-07-19', 'YYYY-MM-DD HH24:MI')
-- AND (
AND T.DL_ST <> ''
UNION ALL
SELECT T.DL_TM + 0 AS TM,
T.PRD AS prd,
T.SWAP_PNT AS swapPnt,
T.TKR_DIR AS tkrDir,
T.NR_LEG_TERM AS nrPrd,
T.NLEG_FWD_PNT AS nrPrice,
T.INTR_NLEG_BASE_CCY_TRDNG_DIR AS nrDir,
T.NR_LEG_RSK_AMNT AS nrVol,
T.FR_LEG_TERM AS frPrd,
T.FLEG_FWD_PNT AS frPrice,
T.INTR_FLEG_BASE_CCY_DIR AS frDir,
T.FR_LEG_RSK_AMNT AS frVol,
T.QTNG_INSTN_CD,
T.QT_INSTN_AGNCY_INSTN_CD,
'Y' AS AGT
FROM TSDEAL.GLD_DL_DTL_HSTRY T
WHERE T.DT_CNFRM = TO_DATE('2018-07-19', 'yyyy-MM-dd')
AND T.PRDCT_CD = ''
AND T.PRD = ''
AND T.CCY_PAIR_CD = ''
AND T.TRDNG_MD_CD = 'QDM'
AND T.FLR_TP = 'Bilateral'
AND trunc(SYSDATE, 'mi') =
to_date('2018-07-19', 'YYYY-MM-DD HH24:MI')
-- AND ( T.MKT_DATA_UPD_TM
AND T.DL_ST <> ''
UNION ALL
SELECT T.DL_TM + 0 AS TM,
tm,
price,
vol,
agt,
CASE
WHEN QTNG_INSTN_CD = '' OR QT_INSTN_AGNCY_INSTN_CD = '' THEN
DECODE('1>2', 'B', 'S', 'S', 'B', '缺省值')
ELSE
''
END AS dir,
T.QTNG_INSTN_CD,
T.QT_INSTN_AGNCY_INSTN_CD,
'Y' AS AGT
FROM TSDEAL.GLD_DL_DTL_HSTRY T
WHERE T.DT_CNFRM = TO_DATE('2018-07-19', 'yyyy-MM-dd')
AND T.PRDCT_CD = ''
AND UPPER(T.PRD) IN ('', '')
AND T.CCY_PAIR_CD = ''
AND T.TRDNG_MD_CD = 'QDM'
AND T.FLR_TP = 'Bilateral'
AND trunc(SYSDATE, 'mi') =
to_date('2018-07-19', 'YYYY-MM-DD HH24:MI')
-- AND (
AND T.DL_ST <> '');
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$业务sql$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

oracle项目代码的更多相关文章

  1. 循序渐进开发WinForm项目(2)--项目代码的分析

    随笔背景:在很多时候,很多入门不久的朋友都会问我:我是从其他语言转到C#开发的,有没有一些基础性的资料给我们学习学习呢,你的框架感觉一下太大了,希望有个循序渐进的教程或者视频来学习就好了. 其实也许我 ...

  2. 手把手教你用SonarQube+Jenkins搭建--前端项目--代码质量管理平台 (Window系统)

    前言 网上教程大多介绍的是Linux系统下SonarQube+Jenkins如何使用,这是因为这两款软件一般都是部署在服务器上,而大多数服务器,采用的都是Linux系统.大多数服务器用Linux的原因 ...

  3. 借助GitHub托管你的项目代码

    PS:话说自己注册了GitHub都很久了,却没有怎么去弄,现在系统学习一下,也把自己的学习经历总结下来share给大家,希望大家都能把GitHub用起来,把你的项目代码happy地托管起来! 一.基本 ...

  4. .NET 项目代码风格要求

    原文:http://kb.cnblogs.com/page/179593/ 项目代码风格要求 PDF版下载:项目代码风格要求V1.0.pdf 代码风格没有正确与否,重要的是整齐划一,这是我拟的一份&l ...

  5. [Asp.net 5] DependencyInjection项目代码分析-目录

    微软DI文章系列如下所示: [Asp.net 5] DependencyInjection项目代码分析 [Asp.net 5] DependencyInjection项目代码分析2-Autofac [ ...

  6. [Asp.net 5] DependencyInjection项目代码分析4-微软的实现(5)(IEnumerable<>补充)

    Asp.net 5的依赖注入注入系列可以参考链接: [Asp.net 5] DependencyInjection项目代码分析-目录 我们在之前讲微软的实现时,对于OpenIEnumerableSer ...

  7. IntelliJ IDEA 乱码解决方案 (项目代码、控制台等)

    IntelliJ IDEA 乱码解决方案 (项目代码.控制台等) 最近IDE从eclipse改成IntelliJ IDEA 了,原因是公司大部分人都在用这个IDE,而且一直推荐用,所以尝尝鲜.换的第一 ...

  8. 【转载】借助GitHub托管你的项目代码

    PS:自己关注博客园有2年之久了,不久前才申请注册账号.GitHub也差不多一年多了,因英语水平刚刚及格,所以去GitHub没有博客园多,也是几个月前才注册了账号,前几天休息时看到 EdisonCho ...

  9. C# API项目代码正确 ,页面出不来的问题

    C# API项目代码正确  页面出不来的问题,截图如下: 解决方法: 在项目里设置好[起始页],就可以了.

随机推荐

  1. git merge 和 git merge --no-ff

    根据这张图片可以看出 git merge –no-ff 可以保存你之前的分支历史.能够更好的查看 merge历史,以及branch 状态. git merge 则不会显示 feature,只保留单条分 ...

  2. 1、Nginx集群tomcat

    一.准备工作 下载nginx,http://nginx.org/,本文采用nginx-1.8.0,下载之后直接解压,免安装 下载tomcat,以配置3台tomcat服务器做负载均衡为例 二.修改tom ...

  3. Linux下安装CollabNetSubversionEdge

    1.首先下载CollabNet Subversion,目前最新版本Subversion Edge 5.2.2 (Linux 64-bit),注意下载的时候需要注册下账号,才允许下载: 2.安装Coll ...

  4. Jenkins进阶-用户权限管理(10)

    在版本发布的由于大家的分工不同,所以想通过控制用户的账号达到权限管理,对每个角色进行权限控制,最初通过"项目矩阵授权策略"的策略对每个项目进行单一的权限控制,当时也满足了效果,随着 ...

  5. spring-整合Struts2

    1. Spring 如何在 WEB 应用中使用 ? 1). 需要额外加入的 jar 包: spring-web-4.0.0.RELEASE.jarspring-webmvc-4.0.0.RELEASE ...

  6. spring-IOC容器(二)

    一.bean配置里面使用外部属性文件: <bean>中添加context Schema定义,Spring 提供了一个<property-placeholder>元素,可以在be ...

  7. ASP.NET AJAX入门系列(7):使用客户端脚本对UpdateProgress编程

    在本篇文章中,我们将通过编写JavaScript来使用客户端行为扩展UpdateProgress控件,客户端代码将使用ASP.NET AJAX Library中的PageRequestManager, ...

  8. Go 并发控制--WaitGroup的使用

    开发过程中,经常task之间的同步问题.例如,多个子task并发完成一部分任务,主task等待他们最后结束. 在Go语言,实现同步的一种方式就是WaitGroup. Example package m ...

  9. mysql57免安装版配置

    1,下载mysql5.7压缩文件[具体到官网下载就行了] 2,解压并把mysql5.7放到c盘根目录下 3,进入mysql5.7主目录修改my-default.ini 重命名为:my.ini [如果没 ...

  10. 胖子哥的大数据之路(11)-我看Intel&&Cloudera的合作

    一.引言 5月8日,作为受邀嘉宾,参加了Intel与Cloudera在北京中国大饭店新闻发布会,两家公司宣布战略合作,该消息成为继Intel宣布放弃大数据平台之后的另外一个热点新闻.对于Intel的放 ...