I am trying to create a view in postgreSQL using function. I want a view name in such a way that, which should be pass by the function as a parameter. For example..
--Table
create table test
( rollno int,
name text);
--Function to create a view
create or replace function fun_view(roll int)
returns void as
$Body$
declare
rec record;
begin
for rec in select * from test where rollno=roll loop
create or replace view "---Name of view should be roll---" as
select rollno from test;
end loop;
$Body$
language plpgsql;