title: Equivalent function for TO_CHAR (in Oracle SQL) in Hive
body: <p>In Oracle SQL (PROC SQL in SAS), we do convert the Numeric value to a String using TO_CHAR which results in different values than the original numeric values. Reference:</p>
  <p><a href="https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions180.htm" rel="nofollow noreferrer">https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions180.htm</a></p>
  <p>In Oracle the input:</p>
  <p>3630818330781419569152</p>
  <p>outputs</p>
  <p>3630818330781420171227</p>
  <p>The above example is done using SAS PROC SQL</p>
  <pre><code>proc sql;
  connect to oracle(..credentials..);
  create table output_table as
  select  myCol1 informat=$50. format=$50. , *
  from    connection to oracle (
  select  to_char(myCol1) myCol2
  from input_table);
  disconnect from oracle;
  </code></pre>
  <p>I am trying to find an equivalent function (TO_CHAR for Oracle SQL) in Hive which does the same.</p>
  <p>I tried with the following which does not achieve the goal.</p>
  <pre><code>df_output = df.limit(5).withColumn(&quot;myCol2&quot;, f.col(&quot;myCol1&quot;).cast(LongType()))
  </code></pre>
  <p>Any help is appreciable.</p>