Re: calculate maximum size in bytes of a table row

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 18 Apr 2008 09:25:28 -0700
Message-ID: <1208535928.434768@bubbleator.drizzle.com>


steven acer wrote:
> how can i calculate the maximum amount of bytes that can be occupied
> by a table row.
> The table might not have any data in it, i'm looking for a calculation
> based on the data types used for columns.All i found so far was
> algorithms to estimate the average size for existing rows.
> i'm trying to spool the contents of some of my tables to flat files,
> and for that i'm trying to figure out if the rows would not be
> truncated by sqlplus due to its bytes/line limitation by calculating
> the maximum size a row can reach in bytes.
> database version is 10g R2 running on RHEL 4

CREATE TABLE t (
ccol VARCHAR2(10),
ncol NUMBER,
dcol DATE);

INSERT INTO t (ccol, ncol, dcol) VALUES ('ABCDEABCDE', 99.99, SYSDATE);

SELECT vsize(ccol), vsize(ncol), vsize(vcol) FROM t;

-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Fri Apr 18 2008 - 11:25:28 CDT

Original text of this message