title: PostgreSQL Function Syntax Error in DECLARE clause
body: <p>I am unable to create this function as I get <strong>syntax error near INTEGER</strong> in <strong>line 6</strong>. Am I missing something here?</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION public.update_application_status_by_token(applicationToken integer, userId integer, newStatus data.applicationstatus)
    RETURNS BOOLEAN
    LANGUAGE sql
  AS $function$
      DECLARE
        applicationId INTEGER;
      BEGIN
        SELECT id INTO applicationId FROM data.listings_applications WHERE token = applicationToken;
        INSERT INTO public.listings_applications_status(application_id, user_id, status)  VALUES (applicationId, userId, newStatus);
        UPDATE public.listings_applications SET status = newStatus WHERE token=applicationToken;
        RETURN TRUE;
        EXCEPTION WHEN OTHERS THEN
          RETURN FALSE;
      END;
  $function$
  </code></pre>