CREATE OR REPLACE FUNCTION nn_db.application_patch(
	in_pk_application nn_db.application.pk_application%TYPE
	, in_fk_status nn_db.application.fk_status%TYPE)
RETURNS TABLE(confirm boolean)
AS $$
BEGIN
	UPDATE nn_db.application
		SET nn_db.application.fk_status = in_fk_status
	WHERE
		nn_db.application.pk_application = in_pk_application;
		
	RETURN QUERY SELECT (	
		CASE WHEN 
			(SELECT fk_status FROM nn_db.application WHERE pk_application = in_pk_application LIMIT 1) = in_fk_status
		THEN True
		ELSE False
		END);
END;
$$ LANGUAGE plpgsql