title: Validate Oracle Column Names
body: <p>In one scenario we are dynamically creating sql to <code>create</code> temp tables on-fly. There is no issue with table_name as it is decided by us however the column-names are provided by sources not in our control. </p>
  
  <p>Usually we would check the column names using below query:</p>
  
  <pre><code>select  ..
  where NOT REGEXP_LIKE (Column_Name_String,'^([a-zA-Z])[a-zA-Z0-9_]*$') 
  OR Column_Name_String is NULL
  OR Length(Column_Name_String) &gt; 30
  </code></pre>
  
  <p>However is there any build in function which can do a more extensive check. Also any input on the above query is welcome as well.</p>
  
  <p>Thanks in advance.</p>
  
  <hr>
  
  <p><strong>Final query based on below answers:</strong></p>
  
  <pre><code>select  ..
  where NOT REGEXP_LIKE (Column_Name_String,'^([a-zA-Z])[a-zA-Z0-9_]{0,29}$') 
  OR Column_Name_String is NULL
  OR Upper(Column_Name_String) in (select Upper(RESERVED_WORDS.Keyword) from V$RESERVED_WORDS RESERVED_WORDS)
  </code></pre>
  
  <p>Particularly not happy with character's like $ in column name either hence won't be using..</p>
  
  <pre><code>dbms_assert.simple_sql_name('VALID_NAME')
  </code></pre>
  
  <p>Instead with regexp I can decide my own set of character's to allow.</p>