Home > Oracle Database / Applications Tips > Oracle data warehousing > A bit wiser with Oracle technology
Oracle Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ORACLE DATA WAREHOUSING

A bit wiser with Oracle technology


Jeff McCormick
10.30.2006
Rating: -3.92- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


It was Thanksgiving morning and Shannon, an architect at ABC Gum Company, was thinking about getting home and eating her turkey dinner when she received an email. The email was a request from the data warehouse team for a table design which would store a complete customer record in a single row. The email went on to say that internal audit had mandated data controls around each attribute and record. Oh, one more thing -- they needed it today!

Fortunately Shannon's company had implemented an information strategy which allowed for a 360-degree view of a customer. She knew the customer attributes that were shared across the enterprise were centrally located, and the remaining attributes were stored locally with each system. In fact, Shannon had helped design a federated customer data model within the corporate metadata repository just days before, which described these attributes and their relationships. With the customer information taken care of, Shannon thought about how she would apply data controls.

She again turned to the metadata repository to help her identify a system of record for each customer attribute. She smiled to herself, remembering her design sessions where she had told her fellow architects, "A 'source of truth' for each attribute will come in handy someday." She also needed to store a rollup "source of truth" for the aggregate row. Again, Shannon had the answer; she would use the base-two numbering values of the primary key in the data source reference table and bitwise logical operations within the Oracle database to denormalize the one-to-many relationship between a customer and its data sources. She could store this value in one column for each row.

Binary numbers

Binary numbers (base two) are most commonly represented as Arabic numeral symbols 0 and 1. Binary numbers are in fact a sequence of bits with each bit representing one of two values.

The following charts show the decimal (base 10) number 13 (10+3) ...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Oracle data warehousing
Tip: Exposing logical attributes with virtual columns
Top five data management buzzwords
Oracle vs. SAP
Core principles of data warehouse design
Saving lives with Oracle
The BI application consolidation challenge
MetaBase scripting for the Oracle data warehousing DBA
The case for data stewardship
Why OLAP deserves more attention
Beyond reporting: Getting value out of your data

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


and its equivalent binary, base 2, number 1101 (8+4+1).

 

10000

1000

100

10

1


Base 10 Numeral

 

 

 

1

3


 

16

8

4

2

1


Base 2 Numeral

 

1

1

0

1


Bitwise logical operations

When bits are manipulated by Boolean logical operators, it is referred to as a bitwise operation. A bitwise operation operates on two-bit patterns of equal lengths by positionally matching their individual bits.

AND
A logical AND of each bit pair results in a 1 if the first bit is 1 AND the second bit is 1. Otherwise the result is zero.

OR
A logical OR of each bit pair results in a 1 if the first bit is 1 OR the second bit is 1. Otherwise, the result is zero.

XOR
A logical XOR of each bit pair results in a 1 if the two bits are different, and 0 if they are the same.

Bitwise Logical Operations


Bit One

Bit Two

AND

OR

XOR


0

0

0

0

0


0

1

0

1

1


1

0

0

1

1


1

1

1

1

0


The central database contained a data source reference table which looked something like this:

Shannon now began to design the customer table. For each customer column, she added a <column>_sot to store the "source of truth" for each attribute. She added a column called data_source_sot, to aggregate the "sources of truth" for each customer.

By adding the values of the data source primary keys she could store one value and use a "bitand" operation to query the column. For example, a row consisting of aggregating data from data sources; CUSTOMER, SALES and CLAIMS would have a value of 13 (1 + 4 + 8) in the data_source_sot column.

BITAND

Syntax

bitand::=
[IMAGE]

BITAND computes an AND operation on the bits of expr1 and expr2, both of which must resolve to nonnegative integers, and returns an integer.

Reference: Oracle Database SQL Reference 10g Release 1 (10.1)

Users could query the single column to determine a row's "source of truth." If the "bitand" operation was successful then the value of the data_source_id (expr2) would be returned else 0.

Here we see the customer record has data from the SALES system.

This function is commonly used with the DECODE function, as illustrated in the example that follows:

The following is a partial table showing the relationship between data sources and rollup values:

Next, Shannon decided to extend Oracle's bitwise functionality by coding OR and XOR functions.

Additional Bitwise Functions

OR

XOR

Reference: http://asktom.oracle.com, Tom Kyte

Glancing at the clock, Shannon sent her design to the data warehouse team as she felt a grumble in her stomach. Just then an announcement came over the speaker wishing everyone a Happy Thanksgiving. It was time to go home. Later, as Shannon sat down to dinner with her family, she reflected on the importance of the information strategy, data architecture and Oracle bitwise technology. "This was a good day," she thought, "I have much to be grateful for."

About the author

Jeff McCormick is a senior data architect at a financial services company and executive director of the Connecticut Oracle User Group. Jeff has worked in IT for almost 20 years as a system, storage and database architect/administrator and has over 15 years of experience with DB2, Sybase, SQL Server, MySQL and Oracle relational database technology. He holds several certifications including Oracle Database 10g Administrator Certified Professional, Microsoft Certified Product (SQL Server) and Certified Sybase Professional Database Administrator. Jeff has performed extensive work in the area of high availability and disaster recovery, speaking and authoring several papers on availability architecture.

Rate this Tip
To rate tips, you must be a member of SearchOracle.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Oracle Development Solutions - SQL, J2EE, XML, SOA
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts