title: How to pass object (table or column) names into a stored procedure
body: <p>As far as the specs to get out of the way, it is PostgreSQL 9.2, with the database through PgAdmin3, and the format of the table as a shapefile. If there are any additional details necessary I will edit and provide. </p>
  
  <p>I essentially want to update integer values in a column of integer values based on whether string values in some other columns are null or not. I eventually want to port my stored function to execute in a java app using jdbc, but I first want to test my function within pgadmin3. I have very little experience with postgresql and am a little fuzzy on the syntax. </p>
  
  <p>So the parameters that I've got somewhat of an idea on needing and what to put in thus far are: name, argmode, argname, argtype, column_name, and lang_name. </p>
  
  <p>I understand that if I'm not returning anything I can either include RETURNS void as $$ or simply not include a return statement. I don't think I need result sets, I just want to replace integer values in a column. I'm not sure how to reference the table that I need in order to pass in the columns I want to process. </p>
  
  <p>Here is the code I have cobbled together thus far: </p>
  
  <pre><code>CREATE [OR REPLACE] FUNCTION handle_malformed([[VARIADIC][]
  table_name.column_name, table_name.column_name, table_name.column_name, table_name.column_name, table_name.column_name, table_name.column_name, table_name.column_name, table_name.column_name])
  
  BEGIN
  LOOP
  IF NAME_1 IS NULL THEN 
  IF LEVEL_DEPT != 0 THEN
      UPDATE AdminBoundaries SET \"LEVEL_DEPT\" = 0;
  ELSE IF NAME_2 IS NULL THEN 
      IF LEVEL_DEPT != 1 THEN
          UPDATE AdminBoundaries SET \"LEVEL_DEPT\" = 1;
  ELSE IF NAME_3 IS NULL THEN 
      IF LEVEL_DEPT != 2 THEN
          UPDATE AdminBoundaries SET \"LEVEL_DEPT\" = 2;
  ELSE IF NAME_4 IS NULL THEN 
      IF LEVEL_DEPT != 3 THEN
          UPDATE AdminBoundaries SET \"LEVEL_DEPT\" = 3;
  ELSE IF NAME_5 IS NULL THEN 
      IF LEVEL_DEPT != 4 THEN
          UPDATE AdminBoundaries SET \"LEVEL_DEPT\" = 4;
  ELSE
      IF LEVEL_DEPT !=5 THEN 
          UPDATE AdminBoundaries SET \"LEVEL_DEPT\" = 5;
  EXCEPTION 
  END LOOP;
  END PROCEDURE;
  $$ LANGUAGE plpgsql;
  
  update handle_malformed(AdminBoundaries.NAME_5, AdminBoundaries.NAME_4, AdminBoundaries.NAME_3, 
  AdminBoundaries.NAME_2, AdminBoundaries.NAME_1, AdminBoundaries.NAME_0, AdminBoundaries.WIKI_URL, AdminBoundaries.LEVEL_DEPT)
  </code></pre>
  
  <p>The logic that I put in is the logic that I put in between the loop and end loop is the logic I want to accomplish.</p>
  
  <p>My specific question is, how do I use the column names from arguments in the SQL?</p>