How to return table based on if condition in Postgesql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saswat36
    New Member
    • Sep 2021
    • 1

    How to return table based on if condition in Postgesql

    CREATE Procedure [dbo].[GetMstDropdownd ata]
    @FieldType varchar(100)='T ypeid'
    AS
    BEGIN
    if @FieldType='IsO ptionalid'
    BEGIN
    SELECT 'Yes' as ddlvalue,'Yes' AS ddltext
    union
    SELECT 'No' as ddlvalue,'No' AS ddltext
    END
    else if @FieldType='Cat egoryid'
    BEGIN
    select [CategoryId] as ddlvalue ,[CategoryName] as ddltext
    from [CategoryMaster] order by CategoryName
    END
    END

    How to convert above sp in Postgresql
Working...