====== pears.DateAndTimeOverLap ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."DateAndTimeOverLap" IS
{create function DateAndTimeOverLap
/* Application Maintained Function / Procedure - DO NOT EDIT*/
(in s1d date,in s1t1 time,in s1t2 time,in s2d date,in s2t1 time,in s2t2 time)
returns tinyint
begin
declare rv tinyint;
declare s1f timestamp;
declare s1t timestamp;
declare s2f timestamp;
declare s2t timestamp;
set rv=0;
if s1t1 is null then
set s1t1='00:00:00'
end if;
if s2t1 is null then
set s2t1='00:00:00'
end if;
if s1t2 is null then
set s1t2='23:59:59'
end if;
if s2t2 is null then
set s2t2='23:59:59'
end if;
set s1f=s1d+s1t1;
set s1t=s1d+s1t2;
set s2f=s2d+s2t1;
set s2t=s2d+s2t2;
if s1t <= s1f then
set s1t=dateadd(day,1,s1t)
end if;
if s2t <= s2f then
set s2t=dateadd(day,1,s2t)
end if;
if s1f < s2t and s1t > s2f then
set rv=1
end if;
return rv
end
}