Skip to content
Advertisement

How do I group “or” in pl/sql

I have legacy sql query that selects bit masks (among other data), something like:

How do I group this output like:

That should be 3

Advertisement

Answer

In order to do bit-wise logic you have to do a “bit” of math. (Bad puns are free around here :-).

Oracle defines the BITAND function. To get a bitwise ‘or’ you can define your own function as:

And for completeness, BITXOR is

Best of luck.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement