Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SizeOf function

Billy VerreynneApr 3 2012 — edited Apr 4 2012
The sizeof() function is common in many programming languages. You provide (most) any variable as argument, and it returns the number of bytes of storage required for that variable.

Ignoring the question +"Why?+" - How do we emulate this in PL/SQL? The length() functions are specific to some data types (e.g. string, LOB, or raw) and numbers, non-scalar and structs are not supported.

The SQL DUMP() function can provide a byte size length for SQL data types (including date and number, excluding user types). But this requires parsing the string returned by the function for extracting the byte size.

Am I the only one missing the old malloc() and move() calls using pointers? :-)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2012
Added on Apr 3 2012
13 comments
1,564 views