I have written below cursor in SQL and working file. But I am not able to run the same cursor on snowflake, please help.
DECLARE @CurrentMonth NVARCHAR(100)
DECLARE @CurrentMonth1 NVARCHAR(100)
DECLARE MYDateCURSOR CURSOR
DYNAMIC
FOR
SELECT Collections_COE FROM [CollectionsAgeing_OTCN024_028_029]
OPEN MYDateCURSOR
FETCH LAST FROM MYDateCURSOR INTO @CurrentMonth
CLOSE MYDateCURSOR
DEALLOCATE MYDateCURSOR
--select value from STRING_SPLIT(@CurrentMonth,'-') ;
select @CurrentMonth1=LEFT(@CurrentMonth,4)+cast(cast(RIGHT(@CurrentMonth,2) as int)-1 as varchar(2))
select Date, x1,y1,x1/y1 as DividedValue, round((x1/y1)-1,5) as Actual from(
SELECT X.Past_Due_0 as x1,Y.Past_Due_0 as y1,X.Collections_COE as Date FROM [CollectionsAgeing_OTCN024_028_029] X
CROSS JOIN [CollectionsAgeing_OTCN024_028_029] Y
WHERE X.Collections_COE=@CurrentMonth and y.Collections_COE=@CurrentMonth1
)z