I have an issue with BITOR when i am trying to update table. I get ORA-00904: "BITOR": invalid identifier
for update Table1 set user= BITOR( user, 4194304);
using Oracle19c.
i would like to do a simple update instead of create function to return bitor result.
someone can help please?
Asked
Active
Viewed 29 times
0

satcha
- 129
- 1
- 13
-
2Oracle doesn't have a BITOR function... (in 19c anyway; apparently there but undocumented in 21c). – Alex Poole Apr 05 '23 at 13:27
-
@AlexPoole really!!! in the documentation the bitor, bitand function exists in oracle https://docs.oracle.com/cd/E41183_01/DR/Bit_Binary_Functions.html#DALc02a_2726006080_257082 – satcha Apr 05 '23 at 13:31
-
That link is for DAL calculation language. See the [Oracle 19c documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Functions.html#GUID-D079EFD3-C683-441F-977E-2C9503089982) for the functions that supports. Which includes BITAND (used in the answer to the linked question), but not BITOR. You don't have to create a function, that just makes life easier; you can do the calculation directly in a query/update. – Alex Poole Apr 05 '23 at 13:34
-
@AlexPoole thanks for the information. However do u have an idea how can i edit this code for oracle ? – satcha Apr 05 '23 at 13:38
-
1The duplicate shows you. Or [see this fiddle](https://dbfiddle.uk/xG3eKrlE) which doesn't use a user-defined function. – Alex Poole Apr 05 '23 at 13:42
-
Have a look at [UTL_RAW](https://docs.oracle.com/en/database/oracle/oracle-database/21/arpls/UTL_RAW.html) – Wernfried Domscheit Apr 05 '23 at 14:54
-
@WernfriedDomscheit - that won't work here; you can convert both numbers to RAW and bit_or those, but the result won't convert back - [fiddle](https://dbfiddle.uk/MENYsFgO) - presumably because of the specifics of the internal representation of numbers. (Or if it does, [it might not be right](https://dbfiddle.uk/OlK-Bwmx).) Unless I'm doing it wrong, which is certainly possible *8-) – Alex Poole Apr 05 '23 at 15:17
-
1@AlexPoole use `CAST_FROM_BINARY_INTEGER` and `CAST_TO_BINARY_INTEGER` than it should be correct. `419304 = 1100110010111101000 42 = 0000000000000101010 => 1100110010111101000 OR 0000000000000101010 = 1100110010111101010` which is 419306. 4194346 seems to be wrong. – Wernfried Domscheit Apr 05 '23 at 16:38
-
@WernfriedDomscheit - I wasn't helping anyone by losing a digit from the number; should be 4194304 (2^22) not 419304. Which still doesn't work with to/from_number, but yes, [it does with to/from_binary_integer](https://dbfiddle.uk/mUdgpwp5). Thanks. (I see you've already added that to the linked question - cool.) – Alex Poole Apr 05 '23 at 17:07