title: Adding months to a date in PostgreSQL shows syntax error
body: <p>I am using Postgres 9.0 version. I want to add some months to a date to calculate the new date and update in a table. Here the number of months to be added will be in integer variable. My code is as follows:</p>
  
  <pre><code>declare numberofmonths smallint = 5;
  update salereg1 set expdate = current_date + interval cast(numberofmonths as text) month;
  </code></pre>
  
  <p>The above code shows syntax error at cast. I don't know how to specify the <code>numberofmonths</code> variable as text.. can anyone help me. what is the mistake I did..</p>