Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> (no subject)

(no subject)

From: Bobak, Mark <>
Date: Tue, 06 Jan 2004 01:39:25 -0800
Message-ID: <>


Well, since I can't sleep, I may as well try solving a problem.

This is a bit odd, and I'm trying to think of the most efficient way to do it. I've set up some bitmaps in my app. Consider we have documents that we want to sell. In order to be able to sell a given doc, we need to have it stored in the vault and we also need to have negotiated the proper contract w/ the publisher. So, I've got two bitmaps, STORAGE and PERMISSIONS.

But, here's the hook. There are 8 different types of storage, so I have an 8 bit mask. However, for every storage type, there are two types of permission. So, I have a 16 bit permissions mask.

What I'd like to do is take my 8-bit STORAGE mask, say it's 10110011 and convert it to 1100111100001111. Note that all I did there was take each bit in the input mask, and make the same value repeat. So, 0 would become 00, 1 would become 11, 10 would become 1100. Does that make sense? Once I've done that, I can take my STORAGE mask that's now stretched to 16 bits, and directly AND it with my PERMISSIONS mask.

So, my question is: Is there a nice, scalable way to take my 8 bits and expand them into 16 bits, in the way that I'm describing? A clever bit twiddling expression would be perfect, but anything that's efficient and scalable will do. (The end product will be hidden behind a view or stored procedure.)

Any thoughts, anyone?

Thanks in advance,


Please see the official ORACLE-L FAQ:

Author: Bobak, Mark

Fat City Network Services    -- 858-538-5051
San Diego, California        -- Mailing list and web hosting services

To REMOVE yourself from this mailing list, send an E-Mail message
to: (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Jan 06 2004 - 03:39:25 CST

Original text of this message