I have a SQL command in SQL-Server, and I need to migrate it to Oracle, but there's a part of the sql that I don't understand how to translate it. Here's the sql:
select * from myTable where id = @id and (Mask & @Mask) = @Mask
I think that It's a binary mask, but I'm not quite sure and I don't know if I can do that in Oracle, could you help me?
Thank you very much
You are correct - this is binary mask.
Oracle provides only BITAND function, others (BITOR, BITXOR) must be self made.
Using BITAND function this select will return value 2:
SELECT BITAND(6,2) FROM DUAL;
So your query in Oracle can be rewritten in following way:
select * from myTable where id = :id and BITAND(Mask, :Mask) = :Mask
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With