oracle 视图的创建,游标,left join
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 视图的创建,游标,left join相关的知识,希望对你有一定的参考价值。
视图的创建:
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的主要内容,如果未能解决你的问题,请参考以下文章