Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: utl_raw, bitwise operation in SELECT
A copy of this was sent to dean_at_gfsmortgage.com
(if that email address didn't require changing)
On Tue, 27 Apr 1999 17:19:36 GMT, you wrote:
>I have this query in my MS-SQL Server database:
>
>select * from MYTABLE where flags &0x0004=4
>
>Does anyone know what I need to do to issue a similar select in Oracle?
>
>I'm having some trouble with it.
>
>Thanks,
>
>-Dean
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
There is an undocumented bitand() function you could use (its used all over in the data dictionary views so it shouldn't be disappearing). Consider:
1* select user_id, to_number(bitand(user_id, 4)) from all_users SQL> / USER_ID TO_NUMBER(BITAND(USER_ID,4))
---------- ---------------------------- 0 0 5 4 11 0 18 0 20 4 21 4 35 0 23 4 24 0 25 0 32 0 33 0 34 0 36 4
14 rows selected.
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |