-------预算--
CREATE OR REPLACE VIEW V_YUSUAN_BGY_WZ20151204 AS
SELECT tb_cube_fc05.pk_entity pk_org,/*主体pk*/
org_orgs.code orgcode,/*主体编码*/
org_orgs.name orgname,/*主体名称*/
tb_cube_fc05.pk_year pk_year,/*年份*/
tb_cube_fc05.pk_month pk_month,/*月份*/
tb_cube_fc05.pk_year||'-'||tb_cube_fc05.pk_month period,/*期间*/
sum(nvl(tb_cube_fc05.value,0)) totalcost,/*费用总额*/
tb_cube_fc05.pk_aimcurr pk_currtype,/*币种pk*/
bd_currtype.code currcode,/*币种编码*/
bd_currtype.name currname/*币种名称*/,tb_budgetsub.objname,tb_cube_fc05.code_version,tb_cube_fc05.ts
FROM tb_cube_fc05 tb_cube_fc05 inner join tb_budgetsub tb_budgetsub on tb_budgetsub.pk_obj=tb_cube_fc05.pk_measure
LEFT JOIN tb_dataattr tb_dataattr
ON (tb_cube_fc05.pk_mvtype = tb_dataattr.pk_obj)
LEFT JOIN org_dept org_dept
ON (tb_cube_fc05.pk_entity = org_dept.pk_dept)
LEFT JOIN org_orgs org_orgs
ON (tb_cube_fc05.pk_entity = org_orgs.pk_org)
LEFT JOIN bd_defdoc bd_defdoc
ON (tb_cube_fc05.pk_fc01 = bd_defdoc.pk_defdoc)
left join bd_currtype on bd_currtype.pk_currtype=tb_cube_fc05.pk_aimcurr
where tb_cube_fc05.CODE_MVTYPE='Budget' and tb_dataattr.objname='预算数' and tb_budgetsub.objname='管理(口径)费用总额' and org_orgs.code='F1001' --F1169 F1001
and substr(tb_cube_fc05.code_version,1) in( select max(substr(code_version,1)) from tb_cube_fc05 )
-- and exists(select ts from (select max(ts) ts from tb_cube_fc05 group by tb_cube_fc05.pk_year ,/*年份*/
-- tb_cube_fc05.pk_month )t where t.ts=tb_cube_fc05.ts)
group by tb_cube_fc05.pk_entity ,/*主体pk*/
org_orgs.code ,/*主体编码*/
org_orgs.name ,/*主体名称*/
tb_cube_fc05.pk_year ,/*年份*/
tb_cube_fc05.pk_month ,/*月份*/
nvl(tb_cube_fc05.value,0) ,/*费用总额*/
tb_cube_fc05.pk_aimcurr ,/*币种pk*/
bd_currtype.code ,/*币种编码*/
bd_currtype.name,tb_budgetsub.objname,tb_cube_fc05.code_version,tb_cube_fc05.ts ---费用调整单
create or replace view v_fyadjust_byg_wz as
select distinct zh.djlxbm,/*费用类型编码*/
tb.billtypename,/*费用类型名称*/
zh.bzbm,/*币种pk*/
cu.name bzname,/*币种名称*/
z.assume_org,/*组织主体pk*/
og.name orgname,/*组织主体name*/
z.assume_amount,/*承担金额*/
z.ysdate,/*费用入账日期*/
z.defitem16,/*费用类型*/
z.defitem27 from er_cshare_detail z inner join er_bxzb zh on z.pk_jkbx=zh.pk_jkbx
left join bd_billtype tb on tb.pk_billtypecode=zh.djlxbm and nvl(tb.dr,0)=0
left join bd_currtype cu on cu.pk_currtype=zh.bzbm and nvl(cu.dr,0)=0
left join org_orgs og on og.pk_org=z.assume_org and nvl(og.dr,0)=0
where zh.djlxbm in('264a','264X-Cxx-0009') and nvl(z.dr,0)=0 and nvl(zh.dr,0)=0; ---采购发票
create or replace view v_po_invoice_bgy_wz as
select pi.pk_org,/*主体pk*/
og.name ogrname,/*主体名称*/
pi.pk_busitype,/*业务流程pk*/
bt.businame,/*业务流程名称*/
pi.dbilldate,/*单据日期*/
sum(nvl(pib.norigtaxmny,0)) norigtaxmny,/*价税合计金额*/
pi.corigcurrencyid,/*币种pk*/cy.name curryname,/*币种名称*/
pi.vmemo,
--pib.vfirstcode,/*来源单据号*/
pi.taudittime provedate,/*审批日期*/
pib.vbdef2 costtype, /*费用类型*/
pib.vbdef3 applydetp /*请购部门*/
from po_invoice pi
inner join po_invoice_b pib
on pi.pk_invoice = pib.pk_invoice
and nvl(pi.dr, 0) = 0
and nvl(pib.dr, 0) = 0
inner join org_orgs og on og.pk_org=pi.pk_org
left join bd_busitype bt
on bt.pk_busitype = pi.pk_busitype
left join bd_currtype cy on cy.pk_currtype=pi.corigcurrencyid
and nvl(bt.dr, 0) = 0
group by pi.pk_org,og.name , pi.pk_busitype,
bt.businame,
pi.corigcurrencyid,cy.name,
pi.vmemo,
--pib.vfirstcode,
pi.taudittime,
pib.vbdef2, pi.dbilldate,
pib.vbdef3; ---采购订单
create or replace view v_po_order_bgy_wz as
select po.pk_busitype,/*业务流程pk*/
bt.businame,/*业务流程名称*/
po.pk_dept,/*采购部门pk*/
de.name deptname,/*采购部门名称*/
de.pk_org,/*采购主体pk*/
og.name orgname, /*采购主体名称*/
pb.vbdef3/*费用类型*/,
pb.norigtaxmny,/*价税合计*/
po.vmemo,
--pb.vsourcecode,/*来源单号*/
po.taudittime /*审批日期*/
from po_order po inner join po_order_b pb on po.pk_order=pb.pk_order and nvl(po.dr,0)=0 and nvl(pb.dr,0)=0
left join org_dept de on de.pk_dept=po.pk_dept and nvl(de.dr,0)=0
left join bd_busitype bt on bt.pk_busitype=po.pk_busitype and nvl(bt.dr,0)=0
left join org_orgs og on og.pk_org=de.pk_org and nvl(og.dr,0)=0;

给你看看我练习的oracle语句的更多相关文章

  1. [转载]T-SQL(Oracle)语句查询执行顺序

    原文链接:http://blog.sina.com.cn/s/blog_61c006ea0100mlgq.html sql语法的分析是从右到左,where子句中的条件书写顺序,基本上对sql性能没有影 ...

  2. 性能测试常用Oracle语句

    性能测试常用Oracle语句 显示数据库当前的连接数 select count(*) from v$process; 显示数据库最大连接数: select value from v$parameter ...

  3. oracle语句随笔

    oracle语句随笔 dmp数据的导入. ; --创建用户 GRANT CONNECT,RESOURCE,DBA TO memsspc; --赋值权限 --cmd 中导入命令 IMP memsspc@ ...

  4. 53个Oracle语句优化规则详解(转)

    Oracle sql 性能优化调整  1. 选用适合的ORACLE优化器        ORACLE的优化器共有3种:a. RULE (基于规则)   b. COST (基于成本) c. CHOOSE ...

  5. Oracle语句优化1

    Oracle语句优化1 优化就是选择最有效的方法来执行SQL语句.Oracle优化器选择它认为最有效的     方法来执行SQL语句.         1. IS   NULL和IS   NOT   ...

  6. oracle语句insert into select如何加后续插入条件

    oracle语句insert into select如何加后续插入条件 2014-01-21 10:48匿名  分类:其他编程语言 | 浏览 2746 次 oracle中有批量插入语句insert i ...

  7. Oracle 语句中“||”代表什么啊?

    Oracle 语句中“||”代表什么啊? Oracle 语句中“||”代表什么啊?跟ServerSQL中的字符串的连接符“+”是一个概念么? 1. 恩是的 是一个含义...select '1'||'2 ...

  8. Oracle语句中IN和=的区别有哪些?

    Oracle语句中IN和=的区别有: 1.首先应用范围不一样:in 可以理解为是范围内的选择:= 只有一个.例如: select sno, sname from t1 where sno in ('s ...

  9. MyBatis项目实战 快速将MySQL转换成Oracle语句

    一.前言 因项目需求,小编要将项目从mysql迁移到oracle中 ~ 之前已经完成 数据迁移 (https://zhengqing.blog.csdn.net/article/details/103 ...

  10. 45个非常有用的oracle语句(摘自尚学堂)

    日期/时间 相关查询 获取当前月份的第一天 运行这个命令能快速返回当前月份的第一天.你可以用任何的日期值替换 “SYSDATE”来指定查询的日期. 1 2 SELECT TRUNC (SYSDATE, ...

随机推荐

  1. fuse文件系统

    用户空间文件系统(Filesystem in Userspace,简称FUSE)是操作系统中的概念,指完全在用户态实现的文件系统.目前Linux通过内核模块对此进行支持.一些文件系统如ZFS,glus ...

  2. VisualStudio2010中创建ASP.Net WebService

    相关资料:http://blog.csdn.net/yapingxin/article/details/7331375 具体操作:1.打开“Microsoft Visual Studio 2010”- ...

  3. [iOS基础控件 - 6.2] LOL英雄列表 UITableView单项显示

    A.需求 1.使用只有一个section的TableView来显示LOL 的英雄列表 2.内容包括标题.副标题.图标 3.使用plain样式 4.使用MVC模式     heros.plist 文件结 ...

  4. zabbix 3.0 安装

    zabbix3.0安装注意: 1.PHP要5.4版本以上 2.防火墙关闭 3.selinux关闭 注:本操作系统为centos 6.5 X86   操作步骤 一.安装PHP 添加 epel 源 # r ...

  5. 利用putty软件连接虚拟机中linux操作系统

    http://jingyan.baidu.com/article/9c69d48fbefe6613c8024e6a.html 大家在使用虚拟的过程中有时候会感觉切换操作系统很不方便,那么有什么方法可以 ...

  6. 获取WMI硬件清单

    WMI服务能够报告详细的硬件信息.通常,每个硬件都来自它们自己的WMI代理类.但是要找出这些硬件类的名字是不容易. 所有硬件类都在同一个WMI根下面,你可以在根类查询所有的硬件: Get-WmiObj ...

  7. 理解virtual方法

    1.使用场景 virtual方法的使用场景:父类告诉子类,继承接口,修改实现,从而可以面向接口编程. non-virtual方法的使用场景:父类告诉子类,继承接口和实现,从而可以代码复用. 2.成员方 ...

  8. LVS NAT模型

    1,环境 VMWare10, CentOS6.3 2,LVS NAT网络规划 可以看到Director机器有2个IP,也就是说需要2张网卡:Real Server只需要一个网卡. VIP: 虚拟IP, ...

  9. php递归无限极分类

    递归无限级分类有几种形式,我这里仅仅举例比較经常使用的三种: 第一种:返回有排序的数组: <?php $data = array( 1 => array( 'id' => 1, 'p ...

  10. Linux下批量改动名字方法

    如果任务是把文件夹下全部的.log后缀文件名称中的2014去掉. 方法一) 脚本 这样的方法通过ls把当前文件夹下全部的文件进行遍历,然后获取文件名称,进行mv操作.例如以下: #!/bin/sh f ...