compare_packages_to_snapshot: avoid failure on NULL evr on Oracle

If one of the first two main WHERE conditions are true (server_pkgs.max_evr is null
or snapshot_pkgs.max_evr is null) Oracle will fail with error:

ORA-30625: method dispatch on NULL SELF argument is disallowed
30625. 00000 -  "method dispatch on NULL SELF argument is disallowed"
*Cause:    A member method of a type is being invoked with a NULL SELF
           argument.
*Action:   Change the method invocation to pass in a valid self argument.

Those cases were tolerated by Perl code, and this patch restores correct behavior
in that sense.
compare_packages_to_snapshot: performance fix

Reduces query time from several minutes to some milliseconds. In a test
environment, speedup was ~2400x.

Results are coherent with Perl code across Oracle and Postgresql according
to tests.
Automatic commit of package [spacewalk-java] release [2.2.91-1].