title: How to declare variable and assign value into that in postgresql?
body: <p>I'm very new in postgresql. I read many posts in this questions, but still don't get correct answer in my simple problem and keep receiving syntax error. I'm trying declare new string variable named parents_d and in the following lines trying to assign new value as well. Please help me!</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION retrieve_parents(cid integer) RETURNS text AS $$ 
  BEGIN
      DECLARE pd text;    
      pd:= 'function';
      RETURN concat(cid,pd);
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>ERROR:  duplicate declaration at or near "pd"
  LINE 4:  pd:= 'function';
           ^</p>
  
  <p>********** Error **********</p>
  
  <p>ERROR: duplicate declaration at or near "pd"
  SQL state: 42601
  Character: 104</p>