2025-06-26 18:47:11 +02:00

23 lines
503 B
Transact-SQL

CREATE FUNCTION [C6Mart].[getCreditRiskClass]
(
@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 =
profilo
from C6Mart.[CODIFICA_CREDITRISK]
where min_val <= @ully and @ully <= max_val
end
else
set @creditClassRisk = null
RETURN @creditClassRisk
END