【发布时间】:2020-03-08 22:34:13
【问题描述】:
如何在 java 中创建包含 3 个表的记录的数据结构?
查询/记录总数。
select * from TRANSACTION where workitemid = '104854'; (1 Record)
select * from WHT where workitemid = '104854'; (1 Record)
select * from FX where workitemid = '104854'; (2 Record)
JAVA 中的数据结构。
PSRResponseReportDTO{
String workitemid;
public PSRResponseReportDTO() {
this.fxDetail = new HashSet<PSRResponseReportDTO>();
this.whtDetails = new HashSet<PSRResponseReportDTO>();
this.invoiceDetails = new HashSet<PSRResponseReportDTO>();
}
}
查询
select ptw.workitemid
, pttd.workitemid as PAY_TXN_TAX_DETAILS_WORK_ID
, ptsi.workitemid as pay_txn_supp_inf_work_id
from TRANSACTION ptw
, WHT pttd
, FX ptsi
where ptw.workitemid = pttd.workitemid (+)
AND ptw.workitemid = ptsi.workitemid (+)
AND ptw.workitemid = '104854'
order by ptw.workitemid;
表没有主键,只有外键。 Fallows 获得的数据的示例。问题是如何确定 Fx 有两行,WHT 有一行?
查询结果:
| PTW | WHT | FX | PTW.COLUMN1 | FX_COLUMN1 | WHT_COLUMN 1 |
+--------+---------+--------+-------------+------------+--------------+
| 104854 | 104854 | 104854 | 1 | 2 | 3 |
| 104854 | 104854 | 104854 | 1 | 2 | 3 |
【问题讨论】:
标签: java sql oracle data-structures oracle11g