Take first 4 values in input parameter using oracle 10g -
i using oracle-10g, im creating 1 query needs take first 4 values in input parameter.
user give many inputs while run report in module, query needs take first 4 values if user gives more 4. take values if user gives less 4 or equal 4. every input value seperated comma(,) user. user's input value parameter in qry.
my qry follows:
select c.country_name,oa.city,oa.country_code,d.departure_no,o.storer_order_id orders o, order_address oa, store_adress sa, departure d, shipment s, luid l, picklist_line_pack_luid pl, storer st,country c o.internal_order_id=oa.internal_order_id , o.shipment_id=s.shipment_id , s.departure_no=d.departure_no , pl.internal_order_id=o.internal_order_id , pl.pack_luid_no=l.luid_no , o.storer_id=st.storer_id , st.store_id=sa.store_id , c.country_code=oa.country_code , d.departure_no in( case when length('9821,9254,225,9821') - nvl(length(replace('9821,9254,225,9821',',')),0) <=3 9821,9254,225,9821 end )
this gives me error "ora-00905: missing keyword"
can plss me out on ???
thanks in advance, priya
and d.departure_no in( case when length('9821,9254,225,9821') - nvl(length(replace('9821,9254,225,9821',',')),0) <=3 9821,9254,225,9821 end )
this condition incorrect - case should return expression, not list of expressions.
you can try this:
and ',' || case when length('9821,9254,225,9821,5') - length(replace('9821,9254,225,9821,5',',')) > 3 substr('9821,9254,225,9821,5', 1, instr('9821,9254,225,9821,5', ',', 1, 4)-1) else '9821,9254,225,9821,5' end || ',' '%,' || d.departure_no || ',%'
Comments
Post a Comment