Of pfecha_lect function
Oracle forgot to put some to_char functions for my buddy. The code is still in production and he does not understand why I think SQL is easier to do than this.
He thinks with the SQL below it will be hard to read.
select upper(to_char(to_date(20070410, 'yyyymmdd'), 'dd month yyyy')) from dual;
create or replace function pfecha_lect(ff_lect in number) return varchar2 is
li_day number;
li_year number;
li_month number;
lv_month varchar2(20);
lv_date varchar2(200);
begin
li_day := substr(ff_lect, 7, 2);
li_year := substr(ff_lect, 1, 4);
li_month := substr(ff_lect, 5, 2);
if li_month = '01' then
lv_month := 'JANUARY';
elsif li_month = '02' then
lv_month := 'FEBRUARY';
elsif li_month = '03' then
lv_month := 'MARCH';
elsif li_month = '04' then
lv_month := 'APRIL';
elsif li_month = '05' then
lv_month := 'MAY';
elsif li_month = '06' then
lv_month := 'JUNE';
elsif li_month = '07' then
lv_month := 'JULY';
elsif li_month = '08' then
lv_month := 'AUGUST';
elsif li_month = '09' then
lv_month := 'SEPTEMBER';
elsif li_month = '10' then
lv_month := 'OCTOBER';
elsif li_month = '11' then
lv_month := 'NOVEMBER';
elsif li_month = '12' then
lv_month := 'DECEMBER';
end if;
lv_date := li_day || ' ' || lv_month || ' ' || li_year;
return(lv_date);
end pfecha_lect;
He thinks with the SQL below it will be hard to read.
select upper(to_char(to_date(20070410, 'yyyymmdd'), 'dd month yyyy')) from dual;
