Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Using bits to store information in the database.

RE: Using bits to store information in the database.

From: Seefelt, Beth <Beth.Seefelt_at_TetleyUSA.com>
Date: Wed, 07 May 2003 07:12:31 -0800
Message-ID: <F001.005924E3.20030507071231@fatcity.com>


You can do something like this -  

VERIFIED := 1
NONVERIFIED := 2
CONFIRMED := 4
NONCONFIRMED := 8
AUDITED := 16   IF BITAND(VALUETOTEST, CONFIRMED) = CONFIRMED THEN /* checks if confirmed bit is set */  

You can also use the utl_raw package for that. But it only accepts raw parameters. You have to do some conversion and its a little messy.  

HTH.   Beth    

-----Original Message-----

Sent: Wednesday, May 07, 2003 10:22 AM
To: Multiple recipients of list ORACLE-L

Looking for advise on storing bits in the Oracle database column. The scenario goes like this:  

define column statusFlag NUMBER(x)
statusFlag can represent the following:  

verified set to 1
nonverified set to 10
confirmed set to 100
non confirmed set to 1000
audited set to 10000  

I believe this gets my point accross.... So here are my questions:

What is the largest amount of bit I can set for a NUMBER(x)?  

How can one set and retrive the information in Oracle based on bits being set?  

Are there any draw backs from using too large of a NUMBER? I can guess one.. wasted space.    

Thanks in advanced,
-Lizz


Do you Yahoo!?
The New
<http://us.rd.yahoo.com/search/mailsig/*http://search.yahoo.com> Yahoo! Search - Faster. Easier. Bingo.

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Seefelt, Beth
  INET: Beth.Seefelt_at_TetleyUSA.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (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 Wed May 07 2003 - 10:12:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US