参数 ZQFS数 作用为获取数据库B的数据条数
参数 ZQFS时间和ZQFS值 作用为获取数据库B的值
数据库A语句:
SELECT
SUBSTR('${ZQFS时间}'
,CASE WHEN rownum=1 THEN 1 ELSE INSTR('${ZQFS时间}',',',1,rownum-1)+1 END
,CASE WHEN rownum='${ZQFS数}' THEN lengthb('${ZQFS时间}') ELSE INSTR('${ZQFS时间}',',',1,rownum) END-CASE WHEN rownum=1 THEN 1 ELSE INSTR('${ZQFS时间}',',',1,rownum-1) END - CASE WHEN (rownum=1 or rownum='${ZQFS数}') THEN 0 ELSE 1 end
) 时间
,SUBSTR('${ZQFS值}'
,CASE WHEN rownum=1 THEN 1 ELSE INSTR('${ZQFS值}',',',1,rownum-1)+1 END
,CASE WHEN rownum='${ZQFS数}' THEN lengthb('${ZQFS值}') ELSE INSTR('${ZQFS值}',',',1,rownum) END-CASE WHEN rownum=1 THEN 1 ELSE INSTR('${ZQFS值}',',',1,rownum-1) END - CASE WHEN (rownum=1 or rownum='${ZQFS数}') THEN 0 ELSE 1 end
) 值
FROM TMMSM01H
WHERE 1=1
AND rownum <='${ZQFS数}'
ZQFS数 函数语句:
SQL("COMM113","SELECT SUM(数) FROM( SELECT TO_CHAR(MSG_TIME+1/24, 'YYYY-MM-DD HH24:')||'00:00' 日期,COUNT(*) 数 FROM ASSIST_2 WHERE MSG_TIME > TO_DATE('"+$开始时刻+"','YYYY-MM-DD HH24:MI:SS') AND MSG_TIME <= TO_DATE('"+$结束时刻+"','YYYY-MM-DD HH24:MI:SS') "+IF(LEN($班组)==0,"","AND DECODE(PROD_SHIFT_GROUP,'A','甲班','B','乙班','C','丙班','D','丁班')='"+$班组+"'")+" GROUP BY TO_CHAR(MSG_TIME+1/24, 'YYYY-MM-DD HH24:')||'00:00')",1)
ZQFS时间 函数语句:
SQL("COMM113","SELECT TO_CHAR(MSG_TIME+1/24, 'YYYY-MM-DD HH24:')||'00:00' 日期,SUM(BA_SEND_XRQ_ZQZL)+SUM(BA_QB_FS_FLOW)+SUM(BB_SEND_XRQ_ZQZL)+SUM(BB_QB_FS_FLOW)+SUM(BC_SEND_XRQ_ZQZL)+SUM(BC_QB_FS_FLOW)+SUM(BD_SEND_XRQ_ZQZL)+SUM(BD_QB_FS_FLOW) FROM ASSIST_2 WHERE MSG_TIME > TO_DATE('"+$开始时刻+"','YYYY-MM-DD HH24:MI:SS') AND MSG_TIME <= TO_DATE('"+$结束时刻+"','YYYY-MM-DD HH24:MI:SS') "+IF(LEN($班组)==0,"","AND DECODE(PROD_SHIFT_GROUP,'A','甲班','B','乙班','C','丙班','D','丁班')='"+$班组+"'")+" GROUP BY TO_CHAR(MSG_TIME+1/24, 'YYYY-MM-DD HH24:')||'00:00'",1) |