-- Function: 桁数チェック関数

-- DROP FUNCTION s_check_length("varchar", int4);

CREATE OR REPLACE FUNCTION s_check_length(var "varchar", num int4)
  RETURNS bool AS
$BODY$
BEGIN
    IF var IS NULL THEN
        RETURN TRUE;
    END IF;
    IF length(var) <= num THEN
        RETURN TRUE;
    ELSE
        RETURN FALSE;
    END IF;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

