473,473 Members | 2,169 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

bitwise

Does any body have solution for performing bitwise on db2 such that I
can call it from function or stored proc
Nov 12 '05 #1
3 2303
Ian
Rangan wrote:
Does any body have solution for performing bitwise on db2 such that I
can call it from function or stored proc


Joe Celko, do you want to get this one? :-)

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2
>> Does any body have solution for performing bitwise on db2 such that
I can call it from function or stored proc <<

Why, yes, I'll take this one! How abusive should I be :)?

Your whole model of SQL and RDBMS is totally wrong. (Hey, that is
mild abuse from me; I'll try to do better the next time:))

SQL is a high level language; it is abstract and defined without
regard to PHYSICAL implementation. Bits and Bytes are the **lowest**
units of hardware-specific, physical implementation you can get. Are
you on a high-end or low-end machine? Does the machine have 8, 16,
32, 64, or 128 bit words? Twos complement or ones complement math?
Hey, the standards allow decimal machines,so bits do not exist at
all!! What about NULLs? To be a datatype, yhou have to have NULLs,
so what is a NULL bit? By definition a bit, is on or off and has no
NULL.

What does the implementation of the host languages do with bits? Did
you know that +1, 0 and -1 are used for BOOLEANs, but not
consistently? That means ALL the host languages - present, future and
not-yet-defined. Surely, no good programmer would ever write
non-portable code by getting to such a low level as bit fiddling!!

What some Newbies, who are still thinking in terms of 2GL and 3GL
programming or even punch cards, do is build a vector for a series of
"yes/no" status codes, failing to see the status as a single
attribute. Imagine you have six components for a loan approval, so
you allocate bits in your 2GL model of the world. You have 64 possible
vectors, but only 5 of them are valid (you cannot be rejected for
bankruptcy and have good credit). For your data integrity, you can:

1) Ignore the problem. This is actually what **most** newbies do. I
then come in and charge their employer (opps, I meant "former
employer") big bucks to do a data quality audit :)

2) Write elaborate CHECK() constraints with UDFs that cannot port and
that run like cold glue.

Now we add a 7-th condition to the vector -- which end does it go on?
Why? How did you get it in the right place on all the possible
hardware that it will ever use? Did all the code that references a
bit in a word by its position do it right after the change?

Programs are employed by the company longer than the people who wrote
them -- remember that little "Y2K" thing?

There are VERY good reasons that we have First Normal Form (1NF).

You need to sit down and think about how to design an encoding of the
data that is high level, general enough to expand, abstract and
portable. For example, is that loan approval a hierarchical code?
concatentation code? vector code? etc? Did you provide codes for
unknown, missing and N/A values? It is not easy to design such
things!!
Nov 12 '05 #3
--CELKO-- wrote:
Why, yes, I'll take this one! How abusive should I be :)? ....
What does the implementation of the host languages do with bits? Did
you know that +1, 0 and -1 are used for BOOLEANs, but not
consistently? That means ALL the host languages - present, future and
not-yet-defined.


Joe,
Don't forget about implementations where +0 and -0 are different values!

If you could also address recent wave of questions how to user row
number in SQL query - it would be great. Please be as abusive as you wish!

Jan M. Nelken
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: jas_lx | last post by:
The basic understanding of what bitwise operators (& ^ | >> << ) comes fairly simple, as long as one has a fundamental understanding of bits, bytes and binary. Having done some Win32...
2
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
8
by: Paul E Collins | last post by:
Suppose I have a few Keys objects: Keys k1 = Keys.V; // V Keys k2 = Keys.Control | Keys.V; // Ctrl+V Keys k3 = Keys.Shift | Keys.J; // Shift+J I need to determine which of these include the...
9
by: Christopher Weaver | last post by:
I know that the bitwise AND of 8 and 4 will return 0 or false and the bitwise AND of 8 and 9 will return 1 or true but I don't know how to write the synax for it in C#. I have a value that ranges...
5
by: noridotjabi | last post by:
I'm learning to program in C and any tutorial or book that I read likes to briefly touch on birdies operators and then move on without giving any sort of example application of them. Call me what...
2
by: Mark Rae | last post by:
Hi, This isn't *specifically* an ASP.NET question, so I've also posted it in the ADO.NET group - however, it's not too far off-topic... Imagine a SQL Server 2005 database with a table with an...
3
by: Jay Ruyle | last post by:
I'm trying to figure out a way to list several items in a listbox and let the user select any number of items in the listbox. I have tried to code in the items as bitwise items but all it stores...
5
by: Gigs_ | last post by:
Can someone explain me bitwise expression? few examples for every expression will be nice x << y Left shift x >y Right shift x & y Bitwise AND x | y Bitwise OR x ^ y Bitwise XOR (exclusive...
45
by: Carramba | last post by:
Hi! I now that I can't do straight forward any bitwise operation on float (double etc..). But I wondering what is the easiest/best way to do this? I was thinking if I have float x=1.1111 so I can...
29
by: Carl Banks | last post by:
Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) Not many people are bit-fiddling these days. One of the main uses of bit fields is flags, but that's not...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.