I want to create a store procedure in PostgreSQL but I see that it always has a return, what I need is to make a simple LIKE I do not need to return anything, this is my query has syntax errors for example it is missing an AS after the name of the store, can I set a @idarticle to the parameters?
CREATE FUNCTION uspSelectlist(varchar, varchar)
idarticulo varchar(6);
descripcion varchar(40);
BEGIN
SELECT IdArticulo, Descripcion FROM tblarticulos
WHERE (@idarticulo IS NULL OR idarticulo ILIKE @idarticulo)
AND (@descripcion IS NULL OR descripcion ILIKE @descripcion)
END;
' LANGUAGE 'plpgsql';
I need to build that store.