title: Dynamic Column Alias Name
body: <p>I am looking for a way where I could set the column alias name as dynamic
  DDL</p>
  
  <pre><code>CREATE TABLE PRODUCTS
  (
  PRODUCT_NAME VARCHAR(20),
  PRODUCT_PRICE INT );
  
  
  INSERT INTO PRODUCTS VALUES ('COKE',20);
  INSERT INTO PRODUCTS VALUES ('PEPSI',10);
  INSERT INTO PRODUCTS VALUES ('FANTA',30);
  INSERT INTO PRODUCTS VALUES ('COKE',30);
  </code></pre>
  
  <p>NOW</p>
  
  <pre><code>SELECT SUM(DECODE(PRODUCTS.PRODUCT_NAME,'COKE',PRODUCTS.PRODUCT_PRICE)) AS SSS
  FROM PRODUCTS
  </code></pre>
  
  <p>would result in </p>
  
  <pre><code>SSS
  50
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SELECT PRODUCT_NAME FROM (SELECT PRODUCT_NAME, ROWNUM AS RANK FROM PRODUCTS 
  WHERE ROWNUM = 1)
  </code></pre>
  
  <p>results in</p>
  
  <pre><code>COKE
  </code></pre>
  
  <p>I would like to replace sss with coke but from a dynamic perspective that if the value is changed in the database so would the alias</p>
  
  <pre><code>SELECT SUM(DECODE(PRODUCTS.PRODUCT_NAME,'COKE',PRODUCTS.PRODUCT_PRICE)) AS
  (
     SELECT PRODUCT_NAME FROM 
     (SELECT PRODUCT_NAME, ROWNUM AS RANK FROM PRODUCTS WHERE ROWNUM = 1)
  )
  FROM PRODUCTS
  </code></pre>