66 lines
1.3 KiB
Transact-SQL
66 lines
1.3 KiB
Transact-SQL
-- Schema: C6Mart
|
|
-- Stored Procedure: PL_S170LimitiMassimi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- [C6Mart].[PL_S170LimitiMassimi] 'S', 'MRVGRG34L25A984D'
|
|
CREATE procedure [C6Mart].[PL_S170LimitiMassimi]--'F','CNCDNL73M56B300U'
|
|
@Rete char(1),
|
|
@CodiceFiscale varchar(16)
|
|
|
|
AS
|
|
BEGIN
|
|
|
|
-- 2/7/2018 - CR NAPOLITANO CASI 11-14 -> Persona Giuridica Retail con Nuovo questionario di profilatura (Legali Rappresentanti/Delegati NON Profilati)
|
|
|
|
DECLARE @newLimiteProfilo varchar(20)
|
|
|
|
if [C6Mart].[getIndicatoreValutazione] (@Rete,@CodiceFiscale, 4) = -1
|
|
set @newLimiteProfilo = 'n.d.'
|
|
else
|
|
select @newLimiteProfilo =
|
|
case experience
|
|
when 0 then 'Minima'
|
|
when 1 then 'Bassa'
|
|
when 2 then 'Medio bassa'
|
|
when 3 then 'Medio alta'
|
|
when 4 then 'Alta'
|
|
else '-'
|
|
|
|
|
|
end
|
|
from C6Mart.MIFID
|
|
WHERE
|
|
RETE = @Rete AND
|
|
COD_FISCALE = @CodiceFiscale
|
|
|
|
|
|
|
|
select 'Limite massimo profilo',
|
|
'-' as Controvalore,
|
|
isnull(risk.descr, 0) as rischioCreditoMassimo,
|
|
isnull(CR.MAX_VAR, 0) as varMassimo,
|
|
'-' as Diversificazione,
|
|
@newLimiteProfilo as Complessita
|
|
|
|
from C6Mart.MIFID AS M
|
|
left JOIN C6Mart.CODIFICA_RISCHIO AS CR
|
|
ON M.PROFILO_ASS = CR.PROFILO
|
|
left join [C6Staging].[RISKCLASS] risk
|
|
ON m.riskclass = risk.cod
|
|
WHERE
|
|
M.RETE = @Rete AND
|
|
M.COD_FISCALE = @CodiceFiscale
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
|