8

Is there a way to retrieve (using a select statement) the size of a blob field in Firebird??

I've a field called "data" and I'd like to know the total size of all the records in the table.

Thanks.

pablo
  • 6,392
  • 4
  • 42
  • 62

2 Answers2

13

I think you can use the OCTET_LENGTH() function.

You should also look at this answer it should be helpful.

Community
  • 1
  • 1
bruno
  • 2,802
  • 1
  • 23
  • 23
2

If the field contains Images or another kind of data or even Text, you can use F_BLOBSIZE(blobfield) from FreeAdHocUDF

Input BLOB TextBLOb For TextBLOb: returns the size/length (similar F_STRINGLENGTH) For BinarBLOb: returns the size of file in byte

José Romero
  • 462
  • 4
  • 9
  • What is better F_BLOBSIZE or OCTET_LENGTH? – hellboy Oct 10 '13 at 11:31
  • @hellboy: OCTET_LENGTH for Firebird 2.1 and up, F_BLOBSIZE for Firebird 2.0 and below. See [the Firebird documentation](http://www.firebirdsql.org/refdocs/langrefupd21-intfunc-octet_length.html) for more details – alldayremix Dec 31 '15 at 17:39