create or replace function CheckStatus(dataflag number,flagmodel number) return number is
  Result number;  --判断因子是否包含某种状态,dataflag为因子标识,flagmodel为状态数据。 包含返回1,不包含返回0。 REN 2011-4-11
  c varchar2(2000);
begin
 select utl_raw.bit_and(Utl_Raw.cast_from_binary_integer(dataflag), Utl_Raw.cast_from_binary_integer(flagmodel)) into c from dual;
 if  c= Utl_Raw.cast_from_binary_integer(flagmodel) then
   Result:=1;
   else
     Result:=0;
  end if;
  return(Result);
end CheckStatus;
如题