Thread: In Operator
08-19-13, 06:42 #1Registered User
- Join Date
- Mar 2013
Unanswered: In Operator
I have a query contains a field transaction_id and datatype for this field is number.
in where condition of below query i have like operator .
In this case if i give transaction_id like '00412552' i am not getting data.
Suppose if i give transaction_id like 00412552 then i am getting data.
i think it is not taking string type for in operator.
Please suggest what is the problem.
SELECT DISTINCT crt.carton_no,
FROM carton crt
RIGHT OUTER JOIN pick_list pl ON(crt.carton_no=pl.carton_no AND crt.shipment_ref_no =pl.shipment_ref_no)
WHERE -- pl.transacton_id is null or pl.transaction_id=0 and
-- crt.status like 'P' and
pl.transaction_id like '00412552'
08-19-13, 06:50 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
you can't store a numeric field with leading zeros
you can only use leading zero's when you format a numeric column appropriately
also you cannot use like with numeric datatype columns
so either convert the datatype to text/string AND pad data with leadign zeros
pl.transaction_id = 412552I'd rather be riding on the Tiger 800 or the Norton