create or replace function func_toidentifyhdchannel(bit_rate float,start_time date,end_time date,thershold float) return number is -/*---------------------------------------------------------------------------------------------------------*/ --/*--created by : venkatesan s --------------------------------------------------------------------*/ --/*--datelastmodified : 02-mar-2008 ---------------------------------------------------------------------*/ --/*--purpose : to derive the hd channel according to the logic ---------------------------------*/ --/*--version : 1.0 -----------------------------------------------------------------------------*/ --/*--sample : select func_toidentifyhdchannel(15 ,sysdate,sysdate+1,30) from dual; ------------*/ -/*---------------------------------------------------------------------------------------------------------*/
v_hd number; --/*--to begin -/*---------------------------------------------------------------------------------------------------------*/ --/*---to check whether the channel is hd and set the boolean is true by bitrate and duration of channel seen-*/ -/*---------------------------------------------------------------------------------------------------------*/ if (bit_rate >= 15 and ((end_time - start_time)*1440) >= thershold) then
v_hd :=1; return v_hd;
else
v_hd := 0; return v_hd;
end if; end; /