The raw type is a data type that is used in Oracle to hold a bit string, similar to char, declared with a raw (L) method, up to 32767 bytes long. The system provides a SYS.UTL_RAW toolkit for raw type operations, and the commonly used functions are as follows:
1, the length of the calculation function, get a RAW type variable length, the unit is byte FUNCTION length (R in RAW) return number; For example: Select Utl_raw.length (' 12344321 ') from dual; Results are: 4
2, splicing function, for stitching two RAW type variables FUNCTION concat (r1 in RAW DEFAULT NULL, & nbsp; r2 in RAW DEFAULT NULL r3 in RAW DEFAULT NULL, & nbsp; r4 in RAW DEFAULT NULL, r5 in RAW DEFAULT NULL, & nbsp; r6 in RAW DEFAULT NULL r7 in RAW DEFAULT NULL, & nbsp; r8 in RAW DEfault NULL, r9 in RAW DEFAULT NULL, & nbsp; R10 in RAW DEFAULT NULL, & nbsp; R11 in RAW DEFAULT NULL, & nbsp; R12 in Raw DEFAULT NULL) return RAW; For example: Select Utl_raw.concat (', ') from dual; Results are: 1234
3. Get Substring function substr (r in RAW, Pos. Binary_integer, Len in Binary_integer DEFAULT NULL) return RAW;
such as: Select Utl_raw.substr (' 12344321 ', 2, 1) from dual; Results are: 34
4, bitwise operation function Bit_and (r1 in raw, R2 in raw) return raw; FUNCTION bit_or (r1 in raw, R2 in raw) return raw; FUNCTION Bit_xor (r1 in raw, R2 in raw) return raw; such as: Select Utl_raw.bit_and (' 12344321 ', ' 0f ') from dual; Select Utl_raw.bit_or (' 12344321 ', ' 0f ') from dual; Select Utl_raw.bit_xor (' 12344321 ', ' 0f ') from dual; The results were: 02344321, 1f344321, 1d344321
5. Assign value to specified byte FUNCTION overlay (overlay_str in RAW, & nbsp; target in RAW, pos in Binary_integer