--EXEC MIG_VALIDATE_CATEGORY_ATTR_TYPE_Sp '', ''
CREATE OR ALTER PROCEDURE MIG_VALIDATE_CATEGORY_ATTR_TYPE_Sp
(
	@STATUS INT = 0 OUT,
	@MESSAGE NVARCHAR(999) = NULL OUT
)
AS 
BEGIN
	DECLARE @CNT INT

	SET @STATUS = 0
	SET @MESSAGE = ''

	SELECT @CNT = COUNT(*) 
	FROM CATEGORY_ATTRS
	WHERE ATTR_TYPE = 	(	SELECT VALUE_ID 
							FROM ZZ_UDCDTYPE 
							WHERE TYPE_NAME = 'UNCH_CATEGORY_ATTR_TYPE' 
							AND SHORT_DESCR = 'CLASS_REF_TYPE'
						)

	IF @CNT > 0
	BEGIN
		SET @STATUS = 1
		SET @MESSAGE = CONCAT(@MESSAGE, 'Category Attributes of type CLASS_REF_TYPE not found.')
	END


	SELECT @STATUS, @MESSAGE
END
