locked
Converting SQL script to Oracle RRS feed

  • Question

  • User417741264 posted

    I created on stored procedure in SQl,Please help me in translating the same into Oracle syantax.

    ALTER Procedure [dbo].[USP_CustomList_SetMenuOrder](
    @RepositoryName AS VARCHAR(250)
    )
    AS
    BEGIN

    DECLARE @MaxMenuOrder INT
    select @MaxMenuOrder = ISNULL(MAX(MenuOrder),0) from SKENavigationDetails

    Declare @TempNavigation table(
    Id int Identity(1,1),
    SKId uniqueIdentifier not null,
    ParentItemId uniqueIdentifier null,
    MenuOrder int null
    );

    Insert into @TempNavigation
    select Id,ParentItemId,ROW_NUMBER() OVER(PARTITION BY ParentItemId ORDER BY Id) as MenuOrder from SKENavigationDetails where MenuOrder=0

    Update SKENavigationDetails
    set MenuOrder = CASE When tmp.ParentItemId is not null Then (tmp.MenuOrder*10) Else @MaxMenuOrder + tmp.MenuOrder*10 End
    from @TempNavigation as tmp
    where SKENavigationDetails.Id=tmp.SKId and Application = @RepositoryName

    END

    Tuesday, May 26, 2015 6:35 AM

All replies