Oracle sql TO_CHAR在jpql select子句中

时间:2014-08-22 11:27:49

标签: java-ee jpa oracle11g jpql

是否可以在jpql中编写以下查询?我目前被迫使用实体管理器的createNativeQuery方法: 此查询属于Oracle11g DB

SELECT TO_CHAR(t6.DCO,'DD-MM-YYYY'),
t0.UAP_DESCRIPTION,
COUNT(t0.UAP_ID)
FROM TRAXN t6,
TRAXN_LINE t5,
EXGN_OBJECT_TRAIL t4,
COUPON t3,
PACK_HEADER t2,
COUPON_BATCH_HEADER t1,
PARTNER_PRODUCT t0
WHERE ((((((t3.CPN_PARTNER = 205)
AND (t3.CPN_IS_REDEEMED    = 1))
AND (t5.TRAXN_DEBIT        = 0))
AND (t3.CPN_PARTNER_SERIAL = t2.BOX_SERIAL))
AND (t6.DCO BETWEEN TO_DATE('01-07-2014', 'DD-MM-YYYY') AND (TO_DATE('31-07-2014', 'DD-MM-YYYY')         +1)))
AND (((((t4.EO_TRAIL_TRANSITION_ID = t5.EO_TRAIL_TRANSITION_ID)
AND (t3.CPN_ID                     = t4.CPN_ID))
AND (t6.TRAXN_ID                   = t5.TRAXN_ID))
AND (t1.CPNB_ID                    = t2.CPNB_ID))
AND (t0.UAP_ID                     = t1.UAP_ID)))
GROUP BY TO_CHAR(t6.DCO,'DD-MM-YYYY'),
t0.UAP_DESCRIPTION
ORDER BY TO_CHAR(t6.DCO,'DD-MM-YYYY'),
t0.UAP_DESCRIPTION

问题在于select子句中的TO_CHAR子句。

0 个答案:

没有答案