PDC_REPORT_CreazioneDB/sql/Collaudo/funzioni/C6MartPeriodico_getCreditRiskClassEmit.sql
2025-06-10 15:29:00 +02:00

23 lines
510 B
Transact-SQL

CREATE FUNCTION [C6MartPeriodico].[getCreditRiskClassEmit]
(
@ully as decimal(10,3),
@NumTitRc as smallint
)
RETURNS smallint
AS
BEGIN
-- Declare the return variable here
DECLARE @creditClassRisk as smallint
SET @ully = @ully/100
-- Add the T-SQL statements to compute the return value here
IF @NumTitRc > 0
begin
SELECT @creditClassRisk =
ordine
from C6MartPeriodico.RischioEmittenti
where min <= @ully and @ully <= max
end
else
set @creditClassRisk = null
RETURN @creditClassRisk
END