CREATE OR REPLACE FUNCTION SP_CM_DEC_FU ( V_COLUMN VARCHAR2 )
  RETURN VARCHAR2
IS
  RESULT VARCHAR2(2032);
BEGIN
  RETURN V_COLUMN;
END SP_CM_DEC_FU;


CREATE OR REPLACE FUNCTION FN_ALLCNT ( DC_ID IN VARCHAR2 )
  RETURN VARCHAR2
IS
Result varchar(200);
begin
  SELECT COUNT(*)  INTO Result
  FROM MOUMI_TOT_REPORT RT, MOUMI_TOT_DOC DC
  WHERE  RT.DOC_ID = dc_id
     AND RT.DOC_ID = DC.ID
     AND RT.DEL_TYPE = 'N';
     
  return(Result);
end FN_ALLCNT;

CREATE OR REPLACE FUNCTION FN_NOTECNT ( DC_ID IN VARCHAR2 )
  RETURN VARCHAR2
IS
Result VARCHAR2(4096);
begin
  SELECT COUNT(*)  INTO Result
  FROM MOUMI_TOT_REPORT RT, MOUMI_TOT_DOC DC
  WHERE  RT.DOC_ID = dc_id
     AND RT.DOC_ID = DC.ID
     AND RT.DEL_TYPE = 'N'
     AND RT.PRSS IN (14);
  return(Result);

end FN_NOTECNT;

CREATE OR REPLACE FUNCTION FN_SNDCNT ( DC_ID IN VARCHAR2 )
  RETURN VARCHAR2
IS
Result VARCHAR2(4096);
begin
  SELECT COUNT(*)  INTO Result
  FROM MOUMI_TOT_REPORT RT, MOUMI_TOT_DOC DC
  WHERE  RT.DOC_ID = dc_id
     AND RT.DOC_ID = DC.ID
     AND RT.DEL_TYPE = 'N'
     AND RT.PRSS IN (6,12);

  return(Result);

end FN_SNDCNT;
