proceduer returning error "ORA-01406: fetched column value was truncated"
Dear:
I am trying to execute the following procedure and but it is returing exception "ORA-01406: fetched column value was truncated" at the first cursor fetch:
--------------------------------------------------------------
CREATE OR REPLACE procedure process_payment is
--cursor, Error is coming from here
cursor cur_EVT is
select msisdn,amount
from cust_pay@tovoucher
where status=0;
Begin
FOR w_cur_EVT in cur_EVT LOOP
var_msisdn := w_cur_EVT.msisdn;
var_amount := w_cur_EVT.amount;
--update e-voucher
update cust_pay@tovoucher
set status=9
where msisdn=var_msisdn
and amount=var_amount
and status=0;
commit;
END LOOP;
insert into process_log (TIME_STAMP,STATUS)
(select sysdate,'successful' from dual);
commit;
EXCEPTION
WHEN OTHERS THEN
rollback;
err_code := SQLERRM;
insert into process_log (TIME_STAMP,STATUS,NOTE)
(select sysdate,'failed',err_code from dual);
Don't have any idea about that error, but u can try the following statement.
Code:
MERGE INTO cust_pay@tovoucher a
USING
( SELECT msisdn,amount
FROM cust_pay@tovoucher
WHERE status=0
)b
ON (
a.msisdn = b.msisdn
a.amount = b.amount
)
WHEN MATCHED THEN
UPDATE SET
a.status = 9;
Bookmarks