you are trying to handle invalid date format in the wrong way
try using a separate try catch block around your pdate
variable
declare
invalid_date varchar2(10) := '201401';
d date;
begin
begin
d := to_date(invalid_date,'yyyymmdd');
exception when others then
dbms_output.put_line('Handling invalid date');
end;
end;