Hi,

I had this problem recently with 4-bit values, too. My solution runs along
those lines:


create table FOO_auxiliary ( nn NUMBER(22), bit_reset NUMBER(22), bit_set
NUMBER(22) );
insert into FOO_auxiliary values (  0,  0,  4 );
insert into FOO_auxiliary values (  1,  1,  5 );
insert into FOO_auxiliary values (  2,  2,  6 );
insert into FOO_auxiliary values (  3,  3,  7 );
insert into FOO_auxiliary values (  4,  0,  4 );
insert into FOO_auxiliary values (  5,  1,  5 );
insert into FOO_auxiliary values (  6,  2,  6 );
insert into FOO_auxiliary values (  7,  3,  7 );
insert into FOO_auxiliary values (  8,  8, 12 );
insert into FOO_auxiliary values (  9,  9, 13 );
insert into FOO_auxiliary values ( 10, 10, 14 );
insert into FOO_auxiliary values ( 11, 11, 15 );
insert into FOO_auxiliary values ( 12,  8, 12 );
insert into FOO_auxiliary values ( 13,  9, 13 );
insert into FOO_auxiliary values ( 14, 10, 14 );
insert into FOO_auxiliary values ( 15, 11, 15 );


-- Reset a flag
update my_table set flags = (select bit_reset from FOO_auxiliary where nn =
flags) where .... ;

-- Set a flag
update my_table set flags = (select bit_set from FOO_auxiliary where nn =
flags) where .... ;


Obviously, this is still manageable for 8 bits (just 256 rows), but not for
higher numbers.
You might want to create a Perl script or similar to create the auxiliary
table automatically!


Regards,
Matthias





> -----Original Message-----
> From: Derek Hinchliffe [mailto:[EMAIL PROTECTED] 
> Sent: Friday, May 28, 2004 2:44 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Bitwise AND/OR in MaxDB
> 
> 
> Zabach, Elke wrote:
> 
> >Derek Hinchliffe wrote:
> >  
> >
> >>Hi all,
> >>
> >>I think this question has been asked a few times before, but I can't
> >>find any definite answer in the archives.
> >>
> >>Are there any bitwise operators in MaxDB?
> >>    
> >>
> >
> >There are no bitwise operators available
> >
> >Elke
> >SAP Labs Berlin
> >  
> >
> 
> Thanks for the reply Elke.
> 
> In that case, does anyone have any suggestions for how to tackle my 
> problem below?  We were doing this in MySQL using bitwise 
> operators and 
> it was working well, but we wanted to migrate to MaxDB for 
> other reasons.
> 
> We have a table column containing 8 bit values, each bit 
> representing a 
> different flag.  We want to be able to easily SELECT based on 
> combinations of these flags.  Elementary stuff when you have bitwise 
> operators, but without them I am at a bit of a loss.
> 
> Will we have to move this to the application layer? (a move 
> which I am 
> hesitant to do because we are dealing with large sets of data that 
> generally filter down to small sets once we've isolated the 
> flags we want)
> 
> Incidently - how are problems like this being tackled in the 
> development 
> of the MySQL-MaxDB proxy?  Will bitwise operators be unavailable, 
> implemented in the proxy somehow or translated somehow into 
> statements 
> that MaxDB can handle? Just curious...
> 
> Cheers
> Derek Hinchliffe
> 
> 
> -- 
> MaxDB Discussion Mailing List
> For list archives: http://lists.mysql.com/maxdb
> To unsubscribe:    
> http://lists.mysql.com/maxdb?> [EMAIL PROTECTED]
> 



-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to