CREATE OR REPLACE FUNCTION office.get_office_id_by_office_code(office_code text) RETURNS integer LANGUAGE plpgsql AS $function$ BEGIN RETURN ( SELECT office.offices.office_id FROM office.offices WHERE office.offices.office_code=$1 ); END $function$