I have a get_bit function in Postgres database. In Oracle, there is no built-in function to handle the get_bit. I need to write my custom Oracle PLSQL function to mimic this get_bit fucntion's behavior. Can anyone have any suggestion on how to do that? Thanks!
The definition of get_bit is as the following:
Extract bit from string
|get_bit(string, offset)||(returns int)|
| ||Extract bit from string|
|get_bit(E'Th\\000omas'::bytea, 45) => 1|
Note that the bits within a byte are numbered with the least significant bit being the zero bit. In the above example, the 'a' is the
byte being referenced and it contains x'61' => 0110 0001 and the third bit from the left (bit 5 starting with zero on the right) is returned.