Getting data from both Native and Wow6432 registry branches


i want to list all Oracle clients installed in my corporate computers.
query 1:
q: if exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Oracle" of registry then names of keys of key "HKEY_LOCAL_MACHINE\SOFTWARE\Oracle" of registry else "Oracle clients not installed" A: JInitiator

query 2:
q: if exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Oracle" of native registry then names of keys of key "HKEY_LOCAL_MACHINE\SOFTWARE\Oracle" of native registry else "Oracle clients not installed" A: JavaDeploy

how can i query for the same product under both native and 32 bit registry branches?



You can use:

of (x32 registry; x64 registry)

Do NOT do this.

Instead do this:

of (x32 registries;x64 registries)

The difference is, my version works on both 32bit and 64bit systems, while the singular version will throw an error on 32bit systems.

This should be what you need:

unique values of names of keys of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Oracle" of (x32 registries;x64 registries)

The IF/THEN/ELSE isn’t required if all of the relevance is pluralized. It is more efficient in this form.

As a general rule, always use plural relevance. (except in cases where singular relevance is required… and even then there are workarounds to use plural relevance in most cases)


Thanks James and Arne, that worked great.


1 Like

Just out of curiousity, why will mine give an error?

Because if I use the software distribution of BigFix and I look at the relevance generated from the msi (and so from BigFix), I see the following:

whose ( value "DisplayVersion" of it as string as 
version >= "" as 
version AND value "Language" of 
it as 
string = "1033") of keys 
of ( x32 registry; (if exists x64 registry then x64 registry else nothing)

The use of singuler (x32 registry; x64 registry) will thow an error on 32-bit systems where “x64 registry” does not exist (the error will be something along the lines of ‘Singular expression refers to a non-existant object’.

The autogenerated version you cite uses an if/then/else clause to avoid referencing x64 registry if it does not exist; but @jgstew’s example is simpler to read by using the plural forms. A plural value can refer to 0 instances, as would be the case when “x64 registries” is evaluated on a 32-bit system.


perfectly clear, thanks man!

@JasonWalker has the correct explanation.

It is not intuitive but when you use plural relevance, you are saying there should be 0 or more of these things, but when you use singular relevance, you are saying that there must be exactly 1 of these, no more, no less.

This is why I always use plural relevance. You might write relevance on a computer with a single NIC, but then it will throw errors on those with multiple.

I always like to assume that there will be either 0 or more than 1 of the result, and plural relevance handles 0, 1, or more than 1 result all equally well.

Plural relevance effectively suppresses most errors.


this is why i love this forum so much… you don’t only get the answer you wanted, you also actually learn stuff :slight_smile:
Thanks jgsew!

1 Like