title: How to create oracle view by a function
body: <p><strong>how to create oracle view by function</strong><br>
   1. First create a type 'p_type'<br>
   2. Create a table 'p_table' as 'p_type'<br>
   3. A function with 'p_table' pipeline  </p>
  
  <pre><code>create or replace type p_type as object (
      v_name varchar(400),
      d_date date,
      i_val number 
  );
  
  create or replace type p_table as table of p_type;
  
  create or replace function get_info return p_table pipelined 
  is
      c number;
  begin
      c := 1;
      /*
          A is table and it has only one 'a' attribute
      */
      for i in (select * from A) loop
          pipe row( p_type(
                      v_name =&gt; SUBSTR(i.A, 1, 10),
                      d_date =&gt; sysdate,
                      i_val  =&gt; c
              ) );
          c := c + 1;
      end loop;
      return;
  end;
  
  
  CREATE VIEW vw_info AS 
      select * from table(get_info);
  </code></pre>