I have a SQL Server function and I want to convert to Oracle function.
This is my function:
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[SUB_FOLDERS]( @GRUP_GRUP NVARCHAR(30),@STATU NVARCHAR(30))
RETURNS @Strings TABLE (GRUP_KODU nvarchar(100))
AS
BEGIN
DECLARE @sonuc nvarchar(4000)
DECLARE merge_cursor CURSOR FAST_FORWARD FOR WITH temptab(id)
AS
( SELECT root.GRUP_KODU FROM GRUP_TABLE root WHERE GRUP_KODU=@GRUP_GRUP AND DURUM=@STATU
UNION ALL
SELECT sub.GRUP_KODU FROM GRUP_TABLE sub, temptab super WHERE sub.GRUP_GRUP = super.id )
SELECT * FROM temptab OPEN merge_cursor WHILE @@FETCH_STATUS = 0
BEGIN
SET @sonuc=''
FETCH NEXT FROM merge_cursor INTO @sonuc if (@sonuc<>'')
INSERT INTO @Strings VALUES (@sonuc)
END
RETURN
END
GO
When I run it on SQL Server it works properly but on Oracle, it gives error.
Error report:
SQL Command: functıon SUB_FOLDERS
Failed: ORA-24344: success with compilation error
24344. 00000 - "success with compilation error"
*Cause: A sql/plsql compilation error occurred.
*Action: Return OCI_SUCCESS_WITH_INFO along with the error code
Thanks in advance.