You cannot specify RAISE in a WHENEVER statement. Delete the statement, or substitute a valid option.