Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of Oracle basic data type storage format-- RAW type

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Original link: https://www.modb.pro/db/23307?xy

Summary: describes the RAW type storage format for Oracle

Compared with other data types, the storage of the RAW type is much more intuitive, and it is exactly the same as the value displayed by the data in SELECT. (SELECT is shown in hexadecimal)

SQL > create table test_raw (id number, raw_date raw (10)); table created. SQL > insert into test_raw values (1, hextoraw ('ff')); 1 line has been created. SQL > drop table test_raw; table has been discarded. SQL > create table test_raw (raw_col raw (10)); table created. SQL > insert into test_raw values (hextoraw ('ff')); 1 line has been created. SQL > insert into test_raw values (hextoraw ('0')); 1 line has been created. SQL > insert into test_raw values (hextoraw ('23fc')); 1 line has been created. SQL > insert into test_raw values (hextoraw ('fffffffffff')); 1 line has been created. SQL > insert into test_raw values (hextoraw ('ffffffffffffffffffff')); 1 line has been created. SQL > insert into test_raw values (utl_raw.cast_to_raw ('051')); 1 line has been created. SQL > select raw_col, dump (raw_col, 16) dump_raw from test_raw RAW_COL DUMP_RAW- FF Typ=23 Len=1: ff00 Typ=23 Len=1: 023FC Typ=23 Len=2: 23c0FFFFFFFFFF Typ=23 Len=6: FLIFF 6 lines have been selected for ff,ff,ff,ffFFFFFFFFFFFFFFFFFFFF Typ=23 Len=10: ff,ff,ff,ff,ff,ff,ff,ff,ff,ff303531 Typ=23 Len=3: 30, 35, and 31.

The storage of the RAW type is simple, and it is easy to compare the query results of the fields with the results of the DUMP.

It is important to note the difference between the two functions that are converted to RAW. When using HEXTORAW, the data in the string is treated as a hexadecimal number. When using UTL_RAW.CAST_TO_RAW, the ASCII code of each character in the string is directly stored in a field of type RAW.

SQL > insert into test_raw values ('gg'); insert into test_raw values (' gg') * ERROR is on line 1: ORA-01465: invalid hexadecimal number SQL > insert into test_raw values (hextoraw ('gg')) Insert into test_raw values (hextoraw ('gg')) * ERROR is on line 1: ORA-01465: invalid hexadecimal number SQL > insert into test_raw values (utl_raw.cast_to_raw (' gg')); 1 line has been created. SQL > select raw_col, dump (raw_col, 16) dump_raw from test_raw RAW_COL DUMP_RAW--FF Typ=23 Len=1: ff00 Typ=23 Len=1: 023FC Typ=23 Len=2: 23 Fc6767 Typ=23 Len=2: 67670FFFFFFFFFFF Typ=23 Len=6: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report