我想导出Order类型的所有项目,其中包含一个名为'TESTCOUPON'的优惠券代码。然而,当我尝试这样做时,我得到了这个错误:
ERROR line 4 at main script: error executing code line at 4 : SQL search error - ORA-00932: inconsistent datatypes: expected - got BLOB
query = 'SELECT item_t0.PK FROM orders item_t0 WHERE ( item_t0.p_appliedcouponcodes = 'TESTCOUPON') AND (item_t0.TypePkString IN (?,?,?) )', values = [8796099149906, 8796099215442, 8796098756690]
我从错误中假设优惠券存储在一个Collection/List中——在这种情况下,我如何通过它进行过滤?
> >SELECT {C:PK} FROM {Order as C} WHERE {C:appliedCouponCodes} = 'TESTCOUPON'
我尝试使用优惠券代码的PK,但它也不工作,它呈现相同的错误。我试着使用LIKE '%TESTCOUPON%',但它说'期望CHAR得到BLOB'。
根据Table结构CouponRedemption引用Order.
所以正确的查询如下。
select { o.code },{o.pk},{cr.couponCode} from {Order as o Join CouponRedemption as cr on {cr.order}={o.pk}} where {code}='TESTCOUPON'
输出:
code PK p_couponcode
1050156308 9499773075501 BUY4
1044303645 9499775172653 BUY4
1042057811 9499796897837 BUY4
1049853832 9499798863917 BUY4