-- ******************************************************************
-- *
-- * Copyright (c) 2000, 2007, Oracle. All rights reserved.
-- *
-- ******************************************************************


SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO



IF EXISTS (SELECT name FROM sysobjects 
         WHERE name = 'CIFOPRTQ' AND type = 'P')
   DROP PROCEDURE CIFOPRTQ
GO

CREATE  PROCEDURE CIFOPRTQ
@P_SA_ID CHAR(10),
@P_SEV_PROC_ID CHAR(10)
AS

BEGIN
    

	SELECT /*+ RULE */
	     COUNT(A.SEV_PROC_ID) SEV_COUNT
	FROM CI_SEV_PROC A
		,CI_SEV_PROC_TMP B
	WHERE A.SA_ID = @P_SA_ID
	AND A.SEV_PROC_ID <> @P_SEV_PROC_ID
	AND B.SEV_PROC_TMPL_CD = A.SEV_PROC_TMPL_CD
	AND B.AUTO_CANCEL_SW = 'Y';


RETURN
END 

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

