title: Varible declaration
body: <p>I Want to assign the variable in the below in plpgsql.</p>
  
  <pre><code>declare file_name varchar;
      i_str varchar(500);
      start_date date;
   end_date date;
  
      select  v_file_name=concat('tmp_',replace(replace(rd.file_name,'.csv',''),'-','_'))  as files  
              ,rd.filter_2 = i_str
      from reports as rd 
      where rd.id = rep_id 
            and rd.status=0;
  
      if ( file_name) is not null
      begin
  
      update report_downloads set status=1 where id =rep_id and status=0
  
      end;
  else 
      begin
      update report_downloads  set status=3 where id =rep_id and status=1
      end;
  
  </code></pre>
  
  <p>But could see below issue:</p>
  
  <p>CONTEXT: invalid type
  SQL state: 42601 
  Character: 202</p>