title: Oracle: update multiple columns with dynamic query
body: <p>I am trying to update all the columns of type NVARCHAR2 to some random string in my database. I iterated through all the columns in the database of type nvarchar2 and executed an update statement for each column.</p>
  
  <pre><code>for i in (
      select 
          table_name,
          column_name 
      from 
          user_tab_columns
      where 
          data_type = 'NVARCHAR2'
      ) loop
  execute immediate 
      'update ' || i.table_name || 'set ' || i.column_name ||
      ' = DBMS_RANDOM.STRING(''X'', length('|| i.column_name ||'))
      where ' || i.column_name || ' is not null';
  </code></pre>
  
  <p>Instead of running an update statement for every column of type nvarchar2, I want to update all the nvarchar columns of a particular table with a single update statement for efficiency(that is, one update statement per 1 table). For this, I tried to bulk collect all the nvarchar columns in a table, into a temporary storage. But, I am stuck at writing a dynamic update statement for this. Could you please help me with this? Thanks in advance!</p>