title: How to create view with the name which can be pass through function as a parameter in postgresql?
body: <p>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..</p>
  
  <p>--Table </p>
  
  <pre><code>create table test
  ( rollno int,
    name text);
  </code></pre>
  
  <p>--Function to create a view</p>
  
  <pre><code>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;
  </code></pre>