Annotation: office.has_child_offices

CREATE OR REPLACE FUNCTION office.has_child_offices(integer)
RETURNS boolean

Information: office.has_child_offices

Schema office
Function Name has_child_offices
Arguments integer
Owner postgres
Result Type boolean
Description

Implementation: office.has_child_offices

CREATE OR REPLACE FUNCTION office.has_child_offices(integer)
 RETURNS boolean
 LANGUAGE plpgsql
AS $function$
BEGIN
    IF EXISTS(SELECT 0 FROM office.offices WHERE parent_office_id=$1 LIMIT 1) THEN
        RETURN true;
    END IF;

    RETURN false;
END
$function$