Function syntax ? - Mailing list pgsql-sql

From Ruben Gouveia
Subject Function syntax ?
Date
Msg-id 51e507b0809091055l2f83eb1dmf983c1e41da46c2a@mail.gmail.com
Whole thread Raw
Responses Re: Function syntax ?
Re: Function syntax ?
List pgsql-sql
Does this syntax look correct? Can anyone think of a better way to write this?

This function will accept two timestamp parameters and determine the highest of the two?

create or replace function fcn_max_dt(p_dt timestamp without time zone,
                                      p_dt2 timestamp without time zone)
returns timestamp without time zone as $$ 
  DECLARE
      v_dt timestamp without time zone;
      v_dt2 timestamp without time zone;
  
  BEGIN
    v_dt := p_dt;
    v_dt2 := p_dt2;

    if v_dt >= v_dt2 then
    return v_dt;
    else
    return v_dt2;
    end if;
       
  END;
$$ LANGUAGE 'plpgsql';


pgsql-sql by date:

Previous
From: Lennin Caro
Date:
Subject: Re: PL/pgSQL function syntax question?
Next
From: "Scott Marlowe"
Date:
Subject: Re: Function syntax ?