**
THIS FUNCTION WILL CHECK WEEKEND DAY<>
CREATE OR REPLACE FUNCTION FNC_ROOMWEEKFLAG (p_room_no varchar,p_day date )
return int
as
v_s char(1);
v_n char(1);
v_m char(1);
v_t char(1);
v_w char(1);
v_h char(1);
v_f char(1);
begin
select SAT_DAY,SUN_DAY,MON_DAY,TUE_DAY,WED_DAY,TUS_DAY,FRI_DAY into v_s,v_n,v_m,v_t,v_w,v_h,v_f
from ot_weekend where OT_NO=p_room_no;
if to_char(p_day,'DY') ='SAT' and nvl(v_s,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='SUN' and nvl(v_n,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='MON' and nvl(v_m,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='TUE' and nvl(v_t,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='WED' and nvl(v_w,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='THU' and nvl(v_h,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='FRI' and nvl(v_f,'N')='Y' then
return 1;
else
return 0;
end if;
exception when others then
return 0;
end;
/
**
select CEIL(32.65) from dual;
select round(32.65) from dual;
output : 33
THIS FUNCTION WILL CHECK WEEKEND DAY<>
CREATE OR REPLACE FUNCTION FNC_ROOMWEEKFLAG (p_room_no varchar,p_day date )
return int
as
v_s char(1);
v_n char(1);
v_m char(1);
v_t char(1);
v_w char(1);
v_h char(1);
v_f char(1);
begin
select SAT_DAY,SUN_DAY,MON_DAY,TUE_DAY,WED_DAY,TUS_DAY,FRI_DAY into v_s,v_n,v_m,v_t,v_w,v_h,v_f
from ot_weekend where OT_NO=p_room_no;
if to_char(p_day,'DY') ='SAT' and nvl(v_s,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='SUN' and nvl(v_n,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='MON' and nvl(v_m,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='TUE' and nvl(v_t,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='WED' and nvl(v_w,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='THU' and nvl(v_h,'N')='Y' then
return 1;
elsif to_char(p_day,'DY') ='FRI' and nvl(v_f,'N')='Y' then
return 1;
else
return 0;
end if;
exception when others then
return 0;
end;
/
select CEIL(32.65) from dual;
select round(32.65) from dual;
output : 33
0 comments:
Post a Comment