Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: HowTo - create user defined sequence with proper serialization
p.santos000_at_gmail.com wrote:
> fitzjarrell_at_cox.net wrote: >> p.santos000_at_gmail.com wrote: >>> bdbafh_at_gmail.com wrote: >>>> p.santos..._at_gmail.com wrote:
>>>> http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/functions102.htm#i78493 >>>> >>>> Peter, >>>> >>>> If what you are indeed after is a sequence of numbers which are 2^^n, >>>> where n = 0,1,2, ... m >>>> One could just create a sequence (e.g. myseq) with a starting value of >>>> 0, increment 1, nocache. >>>> Create a function to return POWER(2,myseq.nextval) and use that in your >>>> insert statement. Return myseq.currval if needed. >>>> >>>> -bdbafh >>> >>> That is an interesting way of doing this, but then I would have to have >>> a sequence per >>> account_id because each value returned is by account_id. Also if my >>> sequence distributed a nextval of "4" and that group later on gets >>> removed from the table, there is no way to re-use that value anymore. >>> >>> -peter >> I'm wondering if the 'requirement' to reuse values is yours, or >> dictated by someone else. I see no real purpose in it except as an >> exercise. >> >> >> David Fitzjarrell > > No the requirement is not mine. The sequence value will actually be > used for bitwise operations. Basically a process needs to quickly > identify if a user has permissions to acccess certain components of a > web page.. The larger the sequence number, the more difficult these > bitwise operations become , so we want to keep the sequence values as > low as possible... that's why we want to re-use them when possible. >
I'm having a hard time reconciling why you want to use a sequence with the information you gave above. Each bit will represent a "certain component". If the bit is set (1) the user has access to that component. If the bit is not set (0) the user does not have access. Why use a sequential number generator here? Bit0 should correspond to Component0. Bit1 should correspond to Component1. Why use a sequential number generator for this?
Cheers,
Brian
-- =================================================================== Brian Peasland dba_at_nospam.peasland.net http://www.peasland.net Remove the "nospam." from the email address to email me. "I can give it to you cheap, quick, and good. Now pick two out of the three" - UnknownReceived on Tue Aug 29 2006 - 14:18:37 CDT