title: Entire columns as parameters to Redshift SP
body: <p>I'm using AWS Redshift where I have a temporary table called <code>temp</code> with <code>latitude</code> and <code>longitude</code> columns.</p>
  <p>I want to use <code>latitude</code> and <code>longitude</code> to perform a calculation for every row of the table. This calculation holds business logic, which is programmed in a stored procedure and is already working.</p>
  <p>The SP is called <code>sp_calculation()</code> under <code>my_schema</code>, it takes two input parameters (<code>latitude</code> and <code>longitude</code>) and returns a single number called <code>g_key</code></p>
  <p>Example: if I run <code>CALL my_schema.sp_calculation(latitude, longitude)</code> I get a single number, <code>g_key</code>, as a result.</p>
  <hr />
  <p>The problem I have is that the stored procedure takes single values as input parameters, not entire columns.</p>
  <p>I would like to pass the entire columns <code>latitude</code> and <code>longitude</code> to the SP or loop across them and, if possible, insert the resulting value <code>g_key</code> into <code>temp</code> (for which I will have to alter the table in order to have the column <code>g_key</code>, I know, but I can do that in a previous step of my workflow)</p>
  <p>Expected results (numbers are illustrative only):</p>
  <p><code>SELECT * FROM temp LIMIT 2;</code></p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>latitude</th>
  <th>longitude</th>
  <th>g_key</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>28</td>
  <td>32</td>
  <td>1000</td>
  </tr>
  <tr>
  <td>30</td>
  <td>32</td>
  <td>990</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Any ideas on how to accomplish this? Thanks in advance</p>