select b.UNITPRICE, b.USEPRICE, b.GOODSQTY, e.unitprice, case when a.insiderid is not null then decode(to_char(a.useday,'day'),'ذائعب‎',d.price3,d.price2) else d.price end as price from gresa_sa_doc a, gresa_sa_dtl_v b, gpcs_placepoint c, zx_temp_hy_jg d, bms_batch_def e where a.rsaid = b.RSAID and b.BATCHID = e.batchid and a.placepointid = c.placepointid and b.GOODSID = d.goodsid(+) and c.entryid = 301 and a.useday between to_date('2015-08-26 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and to_date('2015-09-25 23:59:59', 'yyyy-mm-dd hh24:mi:ss')