关于Oracle中的raw类型 oracleraw
程序员文章站
2022-05-16 12:54:15
...
select length(a.object_id),
a.object_id,
utl_raw.bit_and(a.object_id, '1111'),
utl_raw.length(a.object_id),
utl_raw.cast_to_number(a.object_id),
rawtohex(a.object_id)
from docversion a
where rownum < 10
and rawtohex(a.object_id) = '4BDF388E1870784D919789D209B72376'
函数:utl_raw.bit_and(column_name,'0110'),即二进制按位与函数。
例如:
1111
0001 0001 0001 0001
4BDF
0100 1011 1101 1111
result:0111
0000 0001 0001 0001
8A58
1000 1010 0101 1000
result:0010
0000 0000 0001 0000
函数:rawtohex(column_name),即将二进制转化为十六进制后的字符串展示格式。
raw:原义,未经加工的,即二进制的(计算机中存储时本质都是采用二进制格式)。
hex:十六进制。
所以函数取名:rawtohex,容易记忆和理解。
区分函数:rawtohex与rowidtochar
select rowidtochar(rowid),rowid,rawtohex(a.object_id),a.object_id from docversion a where rownum <10
如下:
ROWIDTOCHAR(ROWID) ROWID RAWTOHEX(A.OBJECT_ID) OBJECT_ID AAAMKmAAPAAACDcAAA AAAMKmAAPAAACDcAAA 4BDF388E1870784D919789D209B72376 4BDF388E1870784D919789D209B72376 AAAMKmAAPAAACDcAAB AAAMKmAAPAAACDcAAB 8A58975A9818354B842F787AE8AC12A5 8A58975A9818354B842F787AE8AC12A5 AAAMKmAAPAAACDcAAC AAAMKmAAPAAACDcAAC C9CB95882E13B74EBAE732EF023BB4B3 C9CB95882E13B74EBAE732EF023BB4B3 AAAMKmAAPAAACDcAAD AAAMKmAAPAAACDcAAD 8220507CAD201847B52D4659F378FFF5 8220507CAD201847B52D4659F378FFF5 AAAMKmAAPAAACDcAAE AAAMKmAAPAAACDcAAE 5D37767A6CB98E4B99A6703F68B44F38 5D37767A6CB98E4B99A6703F68B44F38 AAAMKmAAPAAACDcAAF AAAMKmAAPAAACDcAAF 79E5404144A25B47A6F4F12748C5581F 79E5404144A25B47A6F4F12748C5581F AAAMKmAAPAAACDcAAG AAAMKmAAPAAACDcAAG 7C14F4FBE7369942BF85AE4BFF637DB3 7C14F4FBE7369942BF85AE4BFF637DB3 AAAMKmAAPAAACDcAAH AAAMKmAAPAAACDcAAH 603E360200F1C3468EC2F013FC72FAFA 603E360200F1C3468EC2F013FC72FAFA AAAMKmAAPAAACDcAAI AAAMKmAAPAAACDcAAI 05949C6252E34F4CADE591B578C699B6 05949C6252E34F4CADE591B578C699B6
编写于【2009-01-14】
a.object_id,
utl_raw.bit_and(a.object_id, '1111'),
utl_raw.length(a.object_id),
utl_raw.cast_to_number(a.object_id),
rawtohex(a.object_id)
from docversion a
where rownum < 10
and rawtohex(a.object_id) = '4BDF388E1870784D919789D209B72376'
函数:utl_raw.bit_and(column_name,'0110'),即二进制按位与函数。
例如:
1111
0001 0001 0001 0001
4BDF
0100 1011 1101 1111
result:0111
0000 0001 0001 0001
8A58
1000 1010 0101 1000
result:0010
0000 0000 0001 0000
函数:rawtohex(column_name),即将二进制转化为十六进制后的字符串展示格式。
raw:原义,未经加工的,即二进制的(计算机中存储时本质都是采用二进制格式)。
hex:十六进制。
所以函数取名:rawtohex,容易记忆和理解。
区分函数:rawtohex与rowidtochar
select rowidtochar(rowid),rowid,rawtohex(a.object_id),a.object_id from docversion a where rownum <10
如下:
ROWIDTOCHAR(ROWID) ROWID RAWTOHEX(A.OBJECT_ID) OBJECT_ID AAAMKmAAPAAACDcAAA AAAMKmAAPAAACDcAAA 4BDF388E1870784D919789D209B72376 4BDF388E1870784D919789D209B72376 AAAMKmAAPAAACDcAAB AAAMKmAAPAAACDcAAB 8A58975A9818354B842F787AE8AC12A5 8A58975A9818354B842F787AE8AC12A5 AAAMKmAAPAAACDcAAC AAAMKmAAPAAACDcAAC C9CB95882E13B74EBAE732EF023BB4B3 C9CB95882E13B74EBAE732EF023BB4B3 AAAMKmAAPAAACDcAAD AAAMKmAAPAAACDcAAD 8220507CAD201847B52D4659F378FFF5 8220507CAD201847B52D4659F378FFF5 AAAMKmAAPAAACDcAAE AAAMKmAAPAAACDcAAE 5D37767A6CB98E4B99A6703F68B44F38 5D37767A6CB98E4B99A6703F68B44F38 AAAMKmAAPAAACDcAAF AAAMKmAAPAAACDcAAF 79E5404144A25B47A6F4F12748C5581F 79E5404144A25B47A6F4F12748C5581F AAAMKmAAPAAACDcAAG AAAMKmAAPAAACDcAAG 7C14F4FBE7369942BF85AE4BFF637DB3 7C14F4FBE7369942BF85AE4BFF637DB3 AAAMKmAAPAAACDcAAH AAAMKmAAPAAACDcAAH 603E360200F1C3468EC2F013FC72FAFA 603E360200F1C3468EC2F013FC72FAFA AAAMKmAAPAAACDcAAI AAAMKmAAPAAACDcAAI 05949C6252E34F4CADE591B578C699B6 05949C6252E34F4CADE591B578C699B6
编写于【2009-01-14】
上一篇: 小丫头可爱经典笑话
下一篇: JAVA/JSP学习系列之二