title: Postgresql stored procedure execute error
body: <p>I created a stored procedure. The function is created successfully. When I call function I get an error. How can I solve this problem?</p>
  
  <p>The error is </p>
  
  <blockquote>
    <p>ERROR:  unrecognized conversion type specifier "a"
    CONTEXT:  PL/pgSQL function dwgcould.updatescale(integer,integer) line 6 at EXECUTE statement
    ********** Error **********
    ERROR: unrecognized conversion type specifier "a"
    SQL state: 22023
    Context: PL/pgSQL function dwgcould.updatescale(integer,integer) line 6 at EXECUTE statement</p>
  </blockquote>
  
  <pre><code>CREATE OR REPLACE FUNCTION scale(IN id integer, IN scale integer) RETURNS integer
  AS $$
  DECLARE 
      result int;
  BEGIN
    IF (SELECT COUNT(*) FROM pg_tables where tablename = format('table_%s_id',id)) &gt; 0 then
      EXECUTE format('update table_%s_id  set geom = ST_Scale(geom, %a, %a',id, scale, scale) using id, scale;
      EXECUTE format('update table_&amp;s_id2  set geom = ST_Scale(geom, %a, %a',id, scale, scale) using id, scale;
      IF FOUND THEN 
          result:= 1;
          return result;
      ELSE 
          result:=0;
          return result;
      END IF; 
    ELSE 
      result:=2;
      return result;
    END IF;
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>