When i run following query on the crystal reports XI version I get error But the report works fine but if i run the same query in Oracle get no erro

SELECT DISTINCT
upper(n.atm_name) atm_name
,m.timestamp,nvl(n.ID,'') atm_id,nvl(b.branch,'') brn_code,nvl(upper(b.ename),'') brn_name,nvl(m.p15_date_set,'') bday, bws_gen.format_ddmm(SUBSTR(m.p07_trans_dt,1,4)) trn_date, bws_gen.format_hhmmss(SUBSTR(m.p07_trans_dt,5,6)) trn_time
, bws_gen.format_ddmm(SUBSTR(m.p07_trans_dt,1,4))||' '||bws_gen.format_hhmmss(SUBSTR(m.p07_trans_dt,5,6 )) trn_dt
, bws_gen.format_ddmm(m.p13_date_local_txn) local_date, bws_gen.format_hhmmss(m.p12_time_local_txn) local_time
,bws_gen.format_ddmm(m.p13_date_local_txn)||' '||bws_gen.format_hhmmss(m.p12_time_local_txn) local_dt, '' tseq,'' onl
, nvl(substr(m.s102_acc_id1,1,12),'') s102_acc_id1, nvl(substr(m.s103_acc_id2,1,12),'') s103_acc_id2,nvl(SUBSTR(m.p02_pan,1,6),'') imd,nvl(SUBSTR(m.p02_pan,7,16),'') crd_no,nvl(TO_NUMBER(m.p23_crd_seq_num),0) crd_seq
, nvl(m.p32_acq_inst_id_code,'') acquirer_code
,DECODE(bws_gen.raw_to_string(SUBSTR(mreq.p61_rese rved_prv, 3,4),4)
,'00', 'Not Tran','01', 'Unconfirmed Dispense','20', 'FastCash','29', 'TCheques', decode(substr(m.p03_pcode,1,2),'99',' - Loro')||

DECODE(bws_gen.raw_to_string(SUBSTR(mreq.p61_reser ved_prv, 1,2),2),0,' Reversal',7,' Reversal',8,' Reversal') tx_type_s

, nvl(m.p04_amt_txn,0) amount

, bc.currency cur

, m.p28_amt_txn_fee

, SUBSTR(m.p41_crd_ac_trm_id,1,4) brn

, SUBSTR(m.p41_crd_ac_trm_id,5,4) txna_atm_id

, cd.branch_id Crd_Brn

, m.p03_pcode proc_code

, m.p04_amt_txn

, m.p05_amt_set

, m.p06_amt_crd_bil

, nvl(m.p11_stan,'')

, nvl(m.p17_date_capt,'') txna_bday

, nvl(m.p20_pan_ext_cc,'')

, decode(substr(m.p03_pcode,1,2),'99',to_number(SUBS TR(m.p37_rrn,9,4)) - 1,SUBSTR(m.p37_rrn,9,4)) seq

, nvl(SUBSTR(m.p37_rrn,9,4),'') seq

, nvl(m.p49_cc_txn,'')

, nvl(m.p50_cc_set,'')

, nvl(m.p51_cc_crd_bil,'')

, decode(substr(m.p03_pcode,1,2),'99','599',bws_gen. raw_to_string(mreq.p61_reserved_prv,6)) fun

, DECODE(m.c1_mti,'0210',decode(to_number(nvl(c.ext_ reason_code,'0')),3,'Offline','Online') ,'0230','Offline','0430','Reversal') txtAuthorization

, nvl(m.s103_acc_id2,'')

, nvl(cd.branch_id,999) Crd_Brn

, nvl(to_char(cd.branch_id),'') Crd_Brnch

, DECODE(m.p39_rsp_code,'00','','10','','11','','16' ,'','R') reject_reason

FROM gw_iso_msg m

inner join bws_atm_network n

on substr(m.p41_crd_ac_trm_id,5,4) = n.id

inner join bws_branches b

on n.branch = b.brn_id

inner join gw_txn_ctrl c

on m.msg_num = c.rsp_num

inner join gw_iso_msg mreq

on mreq.msg_num = c.rq_num

left outer join cms_card cd

on cd.card_num = m.p02_pan

AND cd.seq_num = to_number(m.p23_crd_seq_num)

inner join bwcurrency bc

on n.currency = bc.isocurrencycode

WHERE bws_gen.raw_to_string(mreq.p61_reserved_prv,2) IN (0,5,6,7,8)

AND m.c1_mti IN ('0210','0230','0430')

AND m.p32_acq_inst_id_code = {?p_acquirer}

AND n.id >= {?p_atm_from}

AND n.id <= {?p_atm_to}

AND m.p15_date_set = {?p_bday}

ORDER BY nvl(substr(m.s102_acc_id1,1,12),''),m.timestamp



When opening the crystal report following error occurs:

Details: ORA-00911: invalid character

(Database Vendor Code 911)



Please help out..