CREATE OR REPLACE FUNCTION core.get_account_id_by_party_code(party_code text) RETURNS bigint LANGUAGE plpgsql STABLE AS $function$ BEGIN RETURN account_id FROM core.parties WHERE core.parties.party_code=$1; END $function$