1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| CREATE OR REPLACE FUNCTION GETDAY_TR (myDate DATE)
RETURN number IS
myNewInt number;
myOldInt number;
oldVue ??? ;
newVue ??? ;
resultTable ??? ;
BEGIN
select
case when 'MONDAY' = SUBSTR(to_char(myDate,'DAY'),0,6) then 3
else 1
end as myDay into myNewInt
from dual;
select
case when 'MONDAY' = SUBSTR(to_char(myDate,'DAY'),0,6) then 4
when 'TUESDAY' = SUBSTR(to_char(myDate,'DAY'),0,7) then 4
else 2
end as myDay into myOldInt
from dual;
Select ...,...,...,...,...,...,...,...
into oldVue From ..... Where .......... ;
Select ...,...,...,...,...,...,...,...,...,...,
into newVue From ..... Where ..........;
Select ....,...,...,...,...,...,...,...,...,...,...,...,...,...,...,...,...,...,...,...,...,...,
into resultVue From newVue a LEFT JOIN oldVue c ON (a.Description=c.Description_old);
return(resultVue);
END; |