Im having a hard time to convert below function from SSMS to databricks function. Any help would be appreciated!
CREATE FUNCTION [dbo].[MaxOf5Values] (@D1 [int],@D2 [int],@D3 [int],@D4 [int],@D5 [int]) RETURNS int
AS
BEGIN
DECLARE @Result int
SET @Result = COALESCE(@D1, @D2, @D3, @D4, @D5)
IF @D2 IS NOT NULL AND @D2 > @Result SET @Result = @D2
IF @D3 IS NOT NULL AND @D3 > @Result SET @Result = @D3
IF @D4 IS NOT NULL AND @D4 > @Result SET @Result = @D4
IF @D5 IS NOT NULL AND @D5 > @Result SET @Result = @D5
RETURN @Result
END