title: Oracle script to do an arithmetic operation on column by column
body: <p>Below is the requirement for an oracle script.
  if C1 , C2 , C3 ... are columns in a table T</p>
  
  <p>When I enter the table name T to the script , it should give the output as </p>
  
  <pre><code>C1 =  COUNT(DISTINCT(C1))/COUNT(C1)
  C2 =  COUNT(DISTINCT(C2))/COUNT(C2)
  C3 =  COUNT(DISTINCT(C3))/COUNT(C3)
  </code></pre>
  
  <p>I tried writing a procedure with a cursor in it which gets the names of columns one by one from the USER_TAB_COLUMNS</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE PROC1(TABLE_NAME IN VARCHAR) AS 
  
  DECLARE 
  col varchar2(30)
  cursor c1 as select column_name from user_tab_columns where table_name ='TABLE_NAME';
  open c1;
  BEGIN 
  Select c1 into col from USER_TAB_COLUMNS WHERE TABLE_NAME ='TABLE_NAME'
  
  END
  </code></pre>
  
  <p>After this I got lost. I am new to this. Please help me with a solution to this problem. I am unable to proceed. Any approach is appreciated.</p>
  
  <p>When the name of the table is entered, the output should be the list of the columns and the values as shown in the arithmetic operation. </p>