title: how to do loop query for all alphabet a to z ( a-z )?
body: <p>this is the query i exceute :</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION alphabetloop () 
     RETURNS RECORD AS $$ 
  DECLARE
     counter INTEGER := 64 ; 
     hsl text :=  'select 1';
     hasil RECORD;
     hasile RECORD;
     i INTEGER := 0 ; 
     j INTEGER := 1 ;
  BEGIN
  
  LOOP 
  EXIT WHEN counter = 90 ; 
  counter := counter + 1 ; 
  SELECT j, i + j INTO i, j ;
  select concat(hsl,concat(' union all select count(*) FROM public.table_name where field_name like ''',(concat(chr(counter),'%''')))) into hsl;
  END LOOP ; 
  for hasil in EXECUTE hsl
          loop                                        
  select hasil into hasile;
  RAISE NOTICE '% : %', chr(counter),hasil;
  END LOOP ; 
  
  RETURN hasile;
  END ; 
  $$ LANGUAGE plpgsql;
  
  select alphabetloop();
  </code></pre>
  
  <p>data output:
  ("(13911)")</p>
  
  <p>message output:</p>
  
  <p>NOTICE:  Z : (1)</p>
  
  <p>NOTICE:  Z : (3411)</p>
  
  <p>NOTICE:  Z : (446)</p>
  
  <p>...</p>
  
  <p>NOTICE:  Z : (13)</p>
  
  <p>Successfully run. Total query runtime: 52 secs 47 msec.
  1 rows affected.</p>
  
  <p>is there a way to return data output to be like:</p>
  
  <p>A | (1)</p>
  
  <p>B | (3411)</p>
  
  <p>C | (446)</p>
  
  <p>D | (166)</p>
  
  <p>...</p>
  
  <p>Z | (13)</p>