in table called customers have varchar2 column(financial_month).
column supposed date column since varchar2 column , due wrong coding, there many data aren't in date format.
eg: 0.15 has been stored in 1 record , many other wrong entries.
now want eliminate wrong entries.
process should follow?
have no clue whatsoever. not able identify wrong entries well. thing know there more 1000 wrong entries.
how remove wrong entries column?
assuming format of "financial months" must mm/yyyy:
create table fm_t (fm varchar2(30)); insert fm_t values ('01/2015'); insert fm_t values ('0.5'); insert fm_t values ('whatsever'); insert fm_t values ('02/2015'); select * fm_t; create or replace function fm_f(fm in varchar2) return integer d date; begin d := to_date(fm, 'fmmm/yyyy'); return 1; exception when others return 0; end; / delete fm_t fm_f(fm) <> 1; select * fm_t; drop function fm_f; drop table fm_t;
Comments
Post a Comment