title: are there any ways to create an insert statement dynamically in Oracle?
body: <p>I want to create an insert statement which columns can be customed.
  First, I create a curosr for select column's name which from a customed table. It works well.</p>
  <pre><code>create or replace procedure PROC_TEST_DATA_INSERT
  (tableNameT in varchar2)
  as
  columnName varchar2(30);
  CURSOR C_Columns IS
    select
       COLUMN_NAME from user_tab_columns
        where table_name = tableNameT;
  begin
  end PROC_TEST_DATA_INSERT;
  </code></pre>
  <p>Then, I want to open the cursor and insert into a table which column's name come from the cursor. But it doesn't work</p>
  <pre><code>create or replace procedure PROC_TEST_DATA_INSERT
  (tableNameT in varchar2)
  as
  columnName varchar2(30);
  CURSOR C_Columns IS
    select
       COLUMN_NAME from user_tab_columns
        where table_name = tableNameT;
  begin
  open C_Columns;
     LOOP
      fetch C_Columns into
            columnName;
  
      insert into
      output(columnName)
      values(columnName);
  
      if  C_Columns%notfound then
          exit;
      end if;
    end LOOP;
    close C_Columns;
  end PROC_TEST_DATA_INSERT;
  </code></pre>
  <pre><code>call PROC_TEST_DATA_INSERT('aTableName')
  </code></pre>
  <p>Then I got
  ORA-01732: data manipulation operation not legal on this view</p>
  <p>Apprently, the question is in the insert statement cause if I change the variable to the concrete column like name, an existing column, it works.</p>
  <pre><code>insert into
      output(name)
      values(columnName);
  </code></pre>
  <p>Are there anyways to create a dynamic insert statement in Oracle, or it's impossible?</p>
  <p>Thanks for your answer!</p>