Site Menu
- Home
- Products
- Downloads
- Documentation
- Support
- Pricing & Orders
- About
- Community
- My Nexus
- Recently Updated ...
- Search...
- Site Login
Search
BitOR
0
DROP ROUTINE IF EXISTS "BITOR";
CREATE FUNCTION BITOR (N1 INTEGER, N2 INTEGER)
RETURNS INTEGER
BEGIN
DECLARE nReturnValue,nS,nTemp Integer DEFAULT 0;
WHILE (N1 > 0 OR N2 > 0) AND nS < 32 DO
IF MOD(N1,2) <> 0 OR MOD(N2,2) <> 0 THEN
SET nTemp = 1;
ELSE
SET nTemp = 0;
END IF;
SET nReturnValue = nReturnValue + (nTemp * POWER(2,nS));
SET N1 = N1 / 2;
SET N2 = N2 / 2;
SET nS = nS + 1;
END WHILE;
RETURN nReturnValue;
END
Category:
SQL Functions & Procedures
Current Version:
1.00
Supported Products:
NexusDB V2
NexusDB V3
Questions? Problems?
- Interested to buy but something put you off?
- Can't find what you're looking for?
- Have a suggestion?
Let us know. If you're having trouble contacting us, please check here.
Site Updates
- May 7 2013 - 10:16pm
- May 7 2013 - 10:10pm
- May 7 2013 - 10:03pm
- May 2 2013 - 12:06am
- Apr 17 2013 - 11:40am













Sorry, But it has limitations
I will try to devise a function that also will work if the most significant bit is set.
Otherwise, if e.g. both N1 and N2 have all bits set, the result here would be 0, when it should be "all bits set", or -1.