简体   繁体   中英

How to convert string to byte and the GB in Oracle SQL?

I have a field which store messages and I want to get how many Gb's this message is consuming. For example message: "Hi how are you?" So I want to convert this string in Gb's

To get the size of the string in gigabytes, you can use:

SELECT LENGTHB( 'Hi how are you?' ) / POWER( 2, 30 ) AS size_in_gigabytes
FROM   DUAL;

Which outputs:

SIZE_IN_GIGABYTES
.000000013969838619232177734375

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM