Jacob:
You are correct, there is no such function. However, it would not be hard to write one that took in a table name and a rowid, built a dynamic query from the table's syscolumns records, and added up length( column ) returning the total. This could be written in SPL, C, or Java.
The only rub would be BLOB and CLOB type columns for which there is not length() function defined. You could fix that though rather easily. The EXCOMPAT datablade package contains the function dbms_lob_getlength(). You could either create a length() function that called that function or, what I have done, is to create a length function that uses the underlying library function. Here:
execute function sysbldprepare( 'excompat.*', 'create' );
CREATE FUNCTION length ( blob ) returns integer
external name "$INFORMIXDIR/extend/excompat.1.0/excompat.bld(dbms_lob_getlength)" language c;
alter function length( blob ) with (Modify External Name =
"$INFORMIXDIR/extend/excompat.1.0/excompat.bld(dbms_lob_getlength)");
REVOKE EXECUTE ON FUNCTION "art".length( blob ) FROM "public" AS "art";
GRANT EXECUTE ON FUNCTION "art".length( blob ) TO "public" AS "art";
CREATE FUNCTION length ( clob ) returns integer
external name "$INFORMIXDIR/extend/excompat.1.0/excompat.bld(dbms_lob_getlength)" language c;
alter function length( clob ) with (Modify External Name =
"$INFORMIXDIR/extend/excompat.1.0/excompat.bld(dbms_lob_getlength)");
REVOKE EXECUTE ON FUNCTION "art".length( clob ) FROM "public" AS "art";
GRANT EXECUTE ON FUNCTION "art".length( clob ) TO "public" AS "art";
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com------------------------------
Original Message:
Sent: Fri May 30, 2025 02:04 AM
From: Jonathan Leffler
Subject: is there a rowsize function in SQL similar to rowid?
You suspect correctly. AFAIK, there is no ROWSIZE function.
------------------------------
Jonathan Leffler
Original Message:
Sent: Thu May 29, 2025 02:15 PM
From: Jacob Salomon
Subject: is there a rowsize function in SQL similar to rowid?
This should be a quickie: Yes or no. And I'd classify it as low priority.
We can always select rowid for an individual row. I was curious, though I could not easily find it with google:
Can I do this in SQL?
select rowsize, rowid, <some real columns>
from <table>
In a table with lots of varchar column I can see a use for such a function. Maybe by another name? Please don't refer me to systables.rowsize; that gives only the full size of a row if all varchars are to their max length. No, I mean for an individual row, ad I am fetching them.
I suspect the answer is no but I am curious.
Thanks.
------------------------------
Jacob Salomon
------------------------------