码迷,mamicode.com
首页 > 数据库 > 详细

oracle 视图的创建,游标,left join

时间:2016-10-22 17:58:26      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:内连接   tor   desc   list   esc   htm   rac   ref   www   

视图的创建:

create or replace view dmv_mat_contract_stock_in_bill as
select csib.*,
sib.STOCK_IO_,
sib.CONFIRM_DATE_
from DM_MAT_CONTRACT_STOCK_IN_BILL csib
left outer join DM_MAT_STOCK_IO_BILL sib on csib.BILL_CODE_ = sib.BILL_CODE_;

Oracle 游标使用: http://www.cnblogs.com/sc-xx/archive/2011/12/03/2275084.html

显式游标

隐式游标:

在表的连接时,有 主表 left outer join 副表 效果一般会比直接内连接要好

内连接使用java代码的代替:可以,拼接字段:

for (Map<String, Object> matContractStockBill : matContractStockBillList) {
                String billCode = (String) matContractStockBill.get("BILL_CODE_");
                List<Map<String, Object>> matContractStockList = MatContractStockService.selectMatContractStock(billCode, null, null, null, null, null, null, null, null, 1, -1, operator);
                String BILL_CONTEXT_ = "";
                for (Map<String, Object> matContractStock : matContractStockList) {
                    String billContext = matContractStock.get("MAT_DESC_") + "(" + matContractStock.get("AMOUNT_") + ")";
                    BILL_CONTEXT_ += billContext + ",";
                }
                matContractStockBill.put("BILL_CONTEXT_", BILL_CONTEXT_);
            }

 

oracle 视图的创建,游标,left join

标签:内连接   tor   desc   list   esc   htm   rac   ref   www   

原文地址:http://www.cnblogs.com/sunnyroot/p/5987921.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!