视图的创建:
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_);
}