HELP!!! : ORA-01858: non-numeric character error
When I try to run the script below, I get this error:
Enter current asof_id (MM/DD/YYYY): 6/8/2012
Table dropped.
Table created.
declare
*
ERROR at line 1:
ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at line 46
Commit complete.
I have spent a couple of hours trying everything possible but can't figure out what I am doing wrong.
accept asofcur prompt 'Enter current asof_id (MM/DD/YYYY): ';
drop table gwa_oet_refresh;
create table gwa_oet_refresh
(
t_general_ky NUMBER(38) ,
t_social_security_id varchar2(9),
t_recipient_last_nm VARCHAR2(100),
t_recipient_first_nm VARCHAR2(100),
t_recipient_middle_nm VARCHAR2(100),
t_servicing_cpac_id_nm VARCHAR2(100),
t_organization_first_line_tx VARCHAR2(50),
t_changed_fld VARCHAR2(30),
t_field_value_new VARCHAR2(15),
t_field_value_old VARCHAR2(15),
t_ending_dt_new DATE,
t_ending_dt_old DATE
)
/
declare
t_general_ky number(38) := null;
t_social_security_id varchar2(9) := null;
t_recipient_last_nm VARCHAR2(100) := null;
t_recipient_first_nm VARCHAR2(100) := null;
t_recipient_middle_nm VARCHAR2(100) := null;
t_servicing_cpac_id_nm VARCHAR2(100) := null;
t_organization_first_line_tx VARCHAR2(50) := null;
t_changed_fld VARCHAR2(30) := null;
t_field_value_new VARCHAR2(15) := null;
t_field_value_old VARCHAR2(15) := null;
t_ending_dt_new DATE;
t_ending_dt_old DATE ;
v_prev_payplan_cd varchar2(60) := null;
v_prev_payplan_end_date date := null;
cursor payplan
is
select a.general_ky,
a.ending_dt,
a.social_security_id,
a.recipient_last_nm,
a.recipient_first_nm,
a.recipient_middle_nm,
a.servicing_cpac_id_nm,
a.organization_first_line_tx,
a.pay_plan_cd,
a.pay_plan_cd_effective_dt
FROM general_hist a
ORDER BY general_ky;
v_payplan payplan%rowtype;
begin
open payplan;
loop
fetch payplan into v_payplan;
exit when payplan%notfound;
if payplan%found then
if to_date(v_payplan.pay_plan_cd_effective_dt)
= to_date('asofcur') then
if payplan%ROWCOUNT = 1 then
v_prev_payplan_cd := v_payplan.pay_plan_cd;
v_prev_payplan_end_date := v_payplan.ending_dt;
else
if to_date(v_prev_payplan_cd) =
to_date(v_payplan.pay_plan_cd) then
v_prev_payplan_cd := v_payplan.pay_plan_cd;
v_prev_payplan_end_date := v_payplan.ending_dt;
else
t_general_ky := v_payplan.general_ky;
t_social_security_id := v_payplan.social_security_id;
t_recipient_last_nm := v_payplan.recipient_last_nm;
t_recipient_first_nm := v_payplan.recipient_first_nm;
t_recipient_middle_nm :=
v_payplan.recipient_middle_nm;
t_servicing_cpac_id_nm :=
v_payplan.servicing_cpac_id_nm;
t_organization_first_line_tx :=
v_payplan.organization_first_line_tx;
t_changed_fld := 'Pay Plan ';
t_field_value_new := v_payplan.pay_plan_cd;
t_field_value_old := v_prev_payplan_cd;
t_ending_dt_new := v_payplan.ending_dt;
t_ending_dt_old := v_prev_payplan_end_date;
v_prev_payplan_cd :=v_payplan.pay_plan_cd;
v_prev_payplan_end_date := v_payplan.ending_dt;
end if;
end if;
end if;
end if;
end loop;
close payplan;
end;
/
commit;
|