oracle项目代码
------------------------------------------------
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项目代码的更多相关文章
- 循序渐进开发WinForm项目(2)--项目代码的分析
随笔背景:在很多时候,很多入门不久的朋友都会问我:我是从其他语言转到C#开发的,有没有一些基础性的资料给我们学习学习呢,你的框架感觉一下太大了,希望有个循序渐进的教程或者视频来学习就好了. 其实也许我 ...
- 手把手教你用SonarQube+Jenkins搭建--前端项目--代码质量管理平台 (Window系统)
前言 网上教程大多介绍的是Linux系统下SonarQube+Jenkins如何使用,这是因为这两款软件一般都是部署在服务器上,而大多数服务器,采用的都是Linux系统.大多数服务器用Linux的原因 ...
- 借助GitHub托管你的项目代码
PS:话说自己注册了GitHub都很久了,却没有怎么去弄,现在系统学习一下,也把自己的学习经历总结下来share给大家,希望大家都能把GitHub用起来,把你的项目代码happy地托管起来! 一.基本 ...
- .NET 项目代码风格要求
原文:http://kb.cnblogs.com/page/179593/ 项目代码风格要求 PDF版下载:项目代码风格要求V1.0.pdf 代码风格没有正确与否,重要的是整齐划一,这是我拟的一份&l ...
- [Asp.net 5] DependencyInjection项目代码分析-目录
微软DI文章系列如下所示: [Asp.net 5] DependencyInjection项目代码分析 [Asp.net 5] DependencyInjection项目代码分析2-Autofac [ ...
- [Asp.net 5] DependencyInjection项目代码分析4-微软的实现(5)(IEnumerable<>补充)
Asp.net 5的依赖注入注入系列可以参考链接: [Asp.net 5] DependencyInjection项目代码分析-目录 我们在之前讲微软的实现时,对于OpenIEnumerableSer ...
- IntelliJ IDEA 乱码解决方案 (项目代码、控制台等)
IntelliJ IDEA 乱码解决方案 (项目代码.控制台等) 最近IDE从eclipse改成IntelliJ IDEA 了,原因是公司大部分人都在用这个IDE,而且一直推荐用,所以尝尝鲜.换的第一 ...
- 【转载】借助GitHub托管你的项目代码
PS:自己关注博客园有2年之久了,不久前才申请注册账号.GitHub也差不多一年多了,因英语水平刚刚及格,所以去GitHub没有博客园多,也是几个月前才注册了账号,前几天休息时看到 EdisonCho ...
- C# API项目代码正确 ,页面出不来的问题
C# API项目代码正确 页面出不来的问题,截图如下: 解决方法: 在项目里设置好[起始页],就可以了.
随机推荐
- JMeter ----与WebDriver安装与测试
JMeter ----与WebDriver安装与测试 主要内容 JMeter安装 WebDriver安装 一个简单的JMeter+WebDriver示例 环境与参考 jvm版本: 1.8.0_65 j ...
- 读DataSnap源代码(六)
具体分析一下DataSanp App与Rest, WebBroker App的不同,先看TDSHTTPService. **************************************** ...
- java 多线程详解
一.重点 重点: 1.创建和启动线程 2.实现线程调度 3.实现线程同步 4.实现线程通信 1.为什么要学习多线程? 当多个人访问电脑上同一资源的时候,要用到多线程,让每个人感觉很多电脑同时为多个人服 ...
- Kafka三款监控工具比较
在之前的博客中,介绍了Kafka Web Console这个监控工具,在生产环境中使用,运行一段时间后,发现该工具会和Kafka生产者.消费者.ZooKeeper建立大量连接,从而导致网络阻塞.并且这 ...
- (转)oms系统安装php的redis扩展
lnmp自带redis安装程序 https://lnmp.org/faq/addons.html ======== 还需要关闭防火墙.如果出现redis server gone away. http: ...
- Delphi中使用ADO连接Excel
第一部分: . 设置ADOConnection的ConnectionString属性的OLE DB的提供者要选择Microsoft Jet 4.0 OLE DB Provider(这本来是用于连接Ac ...
- [置顶] Web用户的身份验证及WebApi权限验证流程的设计和实现 (不是Token驗證!!!不是Token驗證!!!都是基於用户身份的票据信息驗證!!!)
转发 http://blog.csdn.net/besley/article/details/8516894 不是Token驗證!!!不是Token驗證!!!都是基於用户身份的票据信息驗證!!! [ ...
- Apache Solr 介绍
Apache Solr 介绍 Solr 是什么? Solr 是一个开源的企业级搜索服务器,底层使用易于扩展和修改的Java 来实现.服务器通信使用标准的HTTP 和XML,所以如果使用Solr 了解J ...
- vue项目中, 字段信息为空时不渲染,是真的不渲染吗
代码 样式,宽度pro_proj 此class设置有宽度,考虑字数如果太多就进入下一行就没有设置高度 样式改为 数据 渲染. 开始以为,null时vue不渲染,然后审查元素,发现渲染的dom是存在的, ...
- pytest.8.使用pytest做简单的接口测试
From: http://www.testclass.net/pytest/test_api/ 背景 我们现在需要测试v2ex网站的查看论坛节点信息的api.具体如下: 节点信息 获得指定节点的名字, ...