2016-08-15 14 views
-4

私は以下の例外を除いています。Exeception =予期せぬトークン:* 1の近くに、

Exeception = unexpected token:* near line 1, COLUMN 603 [ 
SELECT 
    a.putwall_id, 
    a.work_control_number, 
    a.lpn, 
    a.putwall_cube_id, 
    a.date_created, 
    a.last_activity_date, 
    b.location, 
    b.work_zone, 
    b.product, 
    b.quantity_required, 
    b.quantity_processed, 
    (b.quantity_required - b.quantity_processed) AS quantity_cut 
FROM 
    work_type_headers a, work_type_lines b 
WHERE 
    UPPER(a.TENANT_ID) = ? 
    AND UPPER(a.COMPANY_ID) = ? 
    AND UPPER(a.FULFILLMENT_CENTER_ID) = ? 
    AND a.work_type = 'PICK' 
    AND a.status <> 'COMPLETED' 
    AND a.work_control_number = b.work_control_number 
    AND b.quantity_required <> b.quantity_processed 
    AND b.status = 'ASSIGNED' 
    AND a.lpn <> ' ' 
    AND NOT exists(SELECT 
        * 
       FROM 
        work_type_lines c 
       WHERE 
        c.work_type = 'BATCHPUTWALL' 
        AND c.status <> 'COMPLETED' 
        AND b.product = c.product) 
    AND NOT exists(SELECT 
        * 
       FROM 
        work_histories d 
       WHERE 
        d.work_control_number = a.work_control_number 
        AND d.work_history_code = 'COMPLETED' 
        AND d.task = 'PUTWALLPUTPULL') 
ORDER BY 
    a.last_activity_date] 

Oracle SQL DeveloperでSQLを実行しても例外はありません。

SELECT 
    a.putwall_id, 
    a.work_control_number, 
    a.lpn, 
    a.putwall_cube_id, 
    a.date_created, 
    a.last_activity_date, 
    b.location, 
    b.work_zone, 
    b.product, 
    b.quantity_required, 
    b.quantity_processed, 
    (b.quantity_required - b.quantity_processed) AS quantity_cut 
FROM 
    work_type_headers a, work_type_lines b 
WHERE 
    UPPER(a.TENANT_ID) = 'XC3' 
    AND UPPER(a.COMPANY_ID) = 'COMPANYABCD' 
    AND UPPER(a.FULFILLMENT_CENTER_ID) = 'DC1' 
    AND a.work_type = 'PICK' 
    AND a.status <> 'COMPLETED' 
    AND a.work_control_number = b.work_control_number 
    AND b.quantity_required <> b.quantity_processed 
    AND b.status = 'ASSIGNED' 
    AND a.lpn <> '' 
    AND NOT exists(SELECT 
        * 
       FROM 
        work_type_lines c 
       WHERE 
        c.work_type = 'BATCHPUTWALL' 
        AND c.status <> 'COMPLETED' 
        AND b.product = c.product) 
    AND NOT exists(SELECT 
        * 
       FROM 
        work_histories d 
       WHERE 
        d.work_control_number = a.work_control_number 
        AND d.work_history_code = 'COMPLETED' 
        AND d.task = 'PUTWALLPUTPULL') 
ORDER BY 
    a.last_activity_date; 
+0

OK、あなたは例外を持っていないされている場合、あなたは私たちに語った...しかし、あなたはあなたがどこを教えを忘れました例外があります。私たちに教えてください。 – mathguy

答えて

0

私は例外の根本原因を突き止めました。 下記のクエリを変更することにより、クエリは例外なく実行されました。 SQLでselect文を使用する場合は、createQueryの代わりにcreateSQLQueryを使用してください。

Query query = sessionFactory.getCurrentSession() 
          .createQuery(GLOBALCONSTANT.PutWall_GetPendingProduct); 

Query query = sessionFactory.getCurrentSession() 
          .createSQLQuery(GLOBALCONSTANT.PutWall_GetPendingProduct); 

最終的なコードに:

Query query = sessionFactory.getCurrentSession() 
          .createQuery(GLOBALCONSTANT.PutWall_GetPendingProduct); 
query.setParameter(0, COMMONUTIL.setDbDefaultString(tenant_id.trim())); 
query.setParameter(1, COMMONUTIL.setDbDefaultString(company_id.trim())); 
query.setParameter(2, COMMONUTIL.setDbDefaultString(fulfillment_center_id.trim())); 
pendingProductBeanObjList = query.list(); 
関連する問題