CREATE OR REPLACE FUNCTION client.fx_check_admin_id(admin_id integer)
RETURNS integer AS
$BODY$
--
-- Проверка admin_id
--
BEGIN
IF NOT (EXISTS(SELECT client.admins.admin_id
FROM client.admins WHERE client.admins.admin_id=$1 LIMIT 1)) THEN
RAISE EXCEPTION 'Admin with admin_id="%" not exists!', $1;
END IF;
RETURN 1;
END
-- eof
$BODY$
LANGUAGE 'plpgsql' IMMUTABLE SECURITY DEFINER
COST 100;
ALTER FUNCTION client.fx_check_admin_id(integer) OWNER TO sk4_admin;
GRANT EXECUTE ON FUNCTION client.fx_check_admin_id(integer) TO sk4_admin;
GRANT EXECUTE ON FUNCTION client.fx_check_admin_id(integer) TO public;
SQL Справочник v0.05 © 2007-2025 Igor Salnikov aka SunDoctor