ORA-00903 PHP Codeigniter中的表名无效

时间:2018-06-07 13:38:19

标签: php oracle codeigniter

我在查询Codeigniter中遇到错误。这是错误

A PHP Error was encountered

Severity: Warning

Message: oci_execute(): ORA-00903: invalid table name

Filename: oci8/oci8_driver.php

Line Number: 286

Backtrace:

File: C:\xampp\htdocs\gadsb\application\helpers\odsxmlops_helper.php
Line: 1369
Function: get

File: C:\xampp\htdocs\gadsb\application\modules\occ\models\M_occ.php
Line: 181
Function: get_monthlyOther

File: C:\xampp\htdocs\gadsb\application\modules\occ\controllers\Occ.php
Line: 227
Function: dataflightmonthly

File: C:\xampp\htdocs\gadsb\index.php
Line: 315
Function: require_once

-

Error Number: 903

ORA-00903: invalid table name

SELECT "M"."MONTH" AS "MONTH", "O"."ALL_OTHER" AS "ALL_OTHER" FROM SELECT TO_DATE(TO_CHAR(SCHEDULED_DEPDT_LC, 'MON-YY'), 'MM-YY') AS MONTH FROM DBODSXML4OPS.XML4OPS WHERE STATUS IN ('Scheduled') and SERVICETYPE IN ('J', 'G') and TO_CHAR(SCHEDULED_DEPDT_LC, 'yyyy-mm-dd') BETWEEN '2018-01-01' AND '2018-06-07' GROUP BY TO_DATE(TO_CHAR(SCHEDULED_DEPDT_LC, 'MON-YY'), 'MM-YY') ORDER BY MONTH) M LEFT JOIN (SELECT TO_DATE(TO_CHAR(SCHEDULED_DEPDT_LC, 'MON-YY'), 'MM-YY') AS MONTH, COUNT(CASE WHEN DBODSXML4OPS.XML4OPS_DELAY.REASONCODE IN ('51','52','90','93','97','98','99') THEN 1 ELSE NULL END) AS ALL_OTHER FROM DBODSXML4OPS.XML4OPS JOIN DBODSXML4OPS.XML4OPS_DELAY on DBODSXML4OPS.XML4OPS.FLIGHTLEGREF = DBODSXML4OPS.XML4OPS_DELAY.FLIGHTLEGREF where STATUS IN ('Scheduled') and SERVICETYPE IN ('J','G') and TO_CHAR(SCHEDULED_DEPDT_LC, 'yyyy-mm-dd') BETWEEN '2018-01-01' AND '2018-06-07' group by TO_DATE(TO_CHAR(SCHEDULED_DEPDT_LC, 'MON-YY'), 'MM-YY') order by MONTH) O ON "M"."MONTH" = "O"."MONTH" ORDER BY "M"."MONTH" DESC

Filename: C:/xampp/htdocs/gadsb/system/database/DB_driver.php

Line Number: 691

是否因为在JOIN条款中我与MONTH而不是ID进行比较?因为在我与ID进行比较的其他功能中,效果很好。

编辑:我在下面发布详细信息查询

SELECT M.MONTH AS MONTH, O.ALL_OTHER AS ALL_OTHER
FROM (SELECT TO_DATE(TO_CHAR(SCHEDULED_DEPDT_LC, 'MON-YY'), 'MM-YY') AS MONTH
      FROM DBODSXML4OPS.XML4OPS
      WHERE STATUS IN ('Scheduled') and SERVICETYPE IN ('J','G') and TO_CHAR(SCHEDULED_DEPDT_LC, 'yyyy-mm-dd') BETWEEN '$datefrom' AND '$dateto'
      GROUP BY TO_DATE(TO_CHAR(SCHEDULED_DEPDT_LC, 'MON-YY'), 'MM-YY')
      ORDER BY MONTH) M
LEFT JOIN (SELECT TO_DATE(TO_CHAR(SCHEDULED_DEPDT_LC, 'MON-YY'), 'MM-YY') AS MONTH, COUNT(CASE WHEN DBODSXML4OPS.XML4OPS_DELAY.REASONCODE IN ('51','52','90','93','97','98','99') THEN 1 ELSE NULL END) AS ALL_OTHER
           FROM DBODSXML4OPS.XML4OPS
           JOIN DBODSXML4OPS.XML4OPS_DELAY on DBODSXML4OPS.XML4OPS.FLIGHTLEGREF = DBODSXML4OPS.XML4OPS_DELAY.FLIGHTLEGREF
           where STATUS IN ('Scheduled') and SERVICETYPE IN ('J','G') and TO_CHAR(SCHEDULED_DEPDT_LC, 'yyyy-mm-dd') BETWEEN '$datefrom' AND '$dateto'
           group by TO_DATE(TO_CHAR(SCHEDULED_DEPDT_LC, 'MON-YY'), 'MM-YY')
           order by MONTH) O ON M.MONTH = O.MONTH
ORDER BY M.MONTH DESC

0 个答案:

没有答案