--Inv	Investimento	021233XY004	BLACK ROCK EQT X 20230215	99999999	300000.000	0.000	300000.000
-- Stored procedure
-- =============================================
-- Author:		Simone D'Elia
-- Create date: Aprile 2022
-- Description: 
-- =============================================
create procedure [C6Mart].[PL_S184CoerenzaESG] --'S','DGSMHL70H08Z404F'
 -- Add the parameters for the stored procedure here
 @Rete char(1), 
 @CodiceFiscale varchar(16)
AS
BEGIN
select Rete,
	   Codice_Fiscale,
	   case when percESG=25.00 then 'Almeno pari al 25%'
	        when percESG=50.00 then 'Almeno pari al 50%'
			when percESG=75.00 then 'Almeno pari al 75%'
			else 'n.d.' end as percESG,
	   pesoSostESG,
	   case when pesoSostESG>=percESG then 'S' else 'N' end as Coerenza  
from C6Staging.VAR_ADEGUATEZZA_INDICATORI
where Rete=@Rete and CODICE_FISCALE=@CodiceFiscale
END