Checking Function Parameter Postgres

Solution 1:

you can use coalesce(nullif(trim(<column-reference>), '') in update query with column reference:

CREATE OR REPLACE FUNCTION update_seller_detail(
        seller_id int,
        seller_name varchar, 
        seller_address varchar, 
        seller_gender varchar
    )
    RETURNS character varying
    LANGUAGE plpgsql
    SECURITY DEFINER
AS
$function$

BEGIN

    IF seller_id ISNULL THEN
        RAISE NOTICE 'Check Parameter';
        return -1;
    ELSE

        UPDATE public.seller s
        SET name    = coalesce(nullif(trim(seller_name), ''), s.name),
            address = coalesce(nullif(trim(seller_address), ''), s.address),
            gender  = coalesce(nullif(trim(seller_gender), ''), s.gender)
        WHERE id = seller_id;

        return 1;
    END IF;
END;
$function$