ORA-00903: invalid table name
416719Mar 11 2004 — edited May 10 2006I am running Toplink 9.0.3 in Oracle 9i database. I have the following code which generates an SQL statement but the table name is missing in the sub query:
---------------------------------------------
ExpressionBuilder collInventoryLines = new ExpressionBuilder();
ExpressionBuilder maxDate = new ExpressionBuilder();
ReportQuery subQuery = new ReportQuery(CollInventoryLines.class, maxDate);
subQuery.addMaximum("adviceDate - max",maxDate.get("adviceDate"));
subQuery.setSelectionCriteria(collInventoryLines.get("collPartNum").equal(orderLine.getLine().getPartNum()));
Expression exp = (collInventoryLines.get("adviceDate").equal(collInventoryLines.subQuery(subQuery))).and
(collInventoryLines.get("collPartNum").equal(orderLine.getLine().getPartNum()));
ReadAllQuery qry = new ReadAllQuery (CollInventoryLines.class, exp);
DLExpressionQuery query = new DLExpressionQuery(qry);
query.setLock(WAIT_ON_LOCK, WAIT_TIME);
Vector collInventoryLinesFoundVec =(Vector) ctx.executeQuery(query,true);
------------------------------------------------
This code generated the following SQL code:
++++++++++++++++++++++++++++++++++++
SELECT ADVICE_DATE, COLL_QTY, <other column names> FROM COLLATERAL_INVENTORY_REF
WHERE ((ADVICE_DATE = (SELECT MAX(ADVICE_DATE) FROM WHERE (COLL_PART_NUM = 'ABC1'))) AND (COLL_PART_NUM = 'ABC1'))
++++++++++++++++++++++++++++++++++++++++
Note that the table name (COLLATERAL_INVENTORY_REF) is missing from the sub query.
Any help will be appreciated.
Thanks!