看下面的代码
select
---? as SID,
A.T_JJZB_ID AS SecuCode,
NULL AS PUBDATE,
NULL AS InfoSource,
A.FSRQ AS EndDate,
NULL AS TYPE_CODE,
DECODE(RN,1,'债券',2,'股票',3,'货币资金',4,'国债',5,'企业债',6,'金融债',7,'可转债',8,'其它债券',9,'其它资产',10,'买入返售债券',11,'权证',NULL)
AS SecuCategoryCode,
DECODE(RN,1,A.ZQZSZ,2,A.Gpsz,3,A.HBZJ,4,A.GZ,5,A.QYZ,6,A.JRZ,7,A.KZZ,8,A.Qtsz,9,A.QTZC,10,A.MRFSZQ,11,A.QZSZ,NULL)
AS HoldingVal,
NULL AS PCTOfNAV,
DECODE(RN,1,A.ZQZSZ_ZSZBL,2,A.Gp_zszbl,3,A.HBZJ_ZSZBL,4,A.GZ_zszbl,5,A.QYZ_zszbl,
6,A.JRZ_zszbl,7,A.KZZ_zszbl,8,A.Qtsz_zszbl,9,A.QTZC_zszbl,10,A.MRFSZQ_zszbl,11,A.QZ_ZSZBL,NULL)
AS PCTOfTotalAsset,
SYSDATE AS EntryTime,
SYSDATE AS UpdateTime,
A.ZHXGRQ AS GroundTime,
'GAZX' AS ResourceID,
A.GUID AS RecordID
FROM JJTZZH_ZC A JOIN (
select level rn from dual connect by level <=11) B
ON A.SCBZ=0 AND A.GKBZ=1 AND DECODE(RN,1,A.ZQZSZ_ZSZBL,2,A.Gp_zszbl,3,A.HBZJ_ZSZBL,4,A.GZ_zszbl,5,A.QYZ_zszbl,
6,A.JRZ_zszbl,7,A.KZZ_zszbl,8,A.Qtsz_zszbl,9,A.QTZC_zszbl,10,A.MRFSZQ_zszbl,11,A.QZ_ZSZBL,NULL) IS NOT NULL
-----AND A.GUID=?
---? as SID,
A.T_JJZB_ID AS SecuCode,
NULL AS PUBDATE,
NULL AS InfoSource,
A.FSRQ AS EndDate,
NULL AS TYPE_CODE,
DECODE(RN,1,'债券',2,'股票',3,'货币资金',4,'国债',5,'企业债',6,'金融债',7,'可转债',8,'其它债券',9,'其它资产',10,'买入返售债券',11,'权证',NULL)
AS SecuCategoryCode,
DECODE(RN,1,A.ZQZSZ,2,A.Gpsz,3,A.HBZJ,4,A.GZ,5,A.QYZ,6,A.JRZ,7,A.KZZ,8,A.Qtsz,9,A.QTZC,10,A.MRFSZQ,11,A.QZSZ,NULL)
AS HoldingVal,
NULL AS PCTOfNAV,
DECODE(RN,1,A.ZQZSZ_ZSZBL,2,A.Gp_zszbl,3,A.HBZJ_ZSZBL,4,A.GZ_zszbl,5,A.QYZ_zszbl,
6,A.JRZ_zszbl,7,A.KZZ_zszbl,8,A.Qtsz_zszbl,9,A.QTZC_zszbl,10,A.MRFSZQ_zszbl,11,A.QZ_ZSZBL,NULL)
AS PCTOfTotalAsset,
SYSDATE AS EntryTime,
SYSDATE AS UpdateTime,
A.ZHXGRQ AS GroundTime,
'GAZX' AS ResourceID,
A.GUID AS RecordID
FROM JJTZZH_ZC A JOIN (
select level rn from dual connect by level <=11) B
ON A.SCBZ=0 AND A.GKBZ=1 AND DECODE(RN,1,A.ZQZSZ_ZSZBL,2,A.Gp_zszbl,3,A.HBZJ_ZSZBL,4,A.GZ_zszbl,5,A.QYZ_zszbl,
6,A.JRZ_zszbl,7,A.KZZ_zszbl,8,A.Qtsz_zszbl,9,A.QTZC_zszbl,10,A.MRFSZQ_zszbl,11,A.QZ_ZSZBL,NULL) IS NOT NULL
-----AND A.GUID=?
用connect得到要转换的列数,在得到要转换的列,注意值的对应。