Search code examples
postgresqlfunctionwith-clause

Postgresql : with clause function


does PostgreSQL support function in with Clause? oracle has the functionality as below

WITH
  function add_fnc(p_id number) return number
  is
  begin
    return p_id + 1; 
  end;
select add_fnc(id1) from test_tbl;

Solution

  • There is no such thing as CTE functions in PostgreSQL (as kofemann noted), but it seems what you are looking for are temporary functions. Take a look How to create a temporary function in PostgreSQL?