I use the LOB data type for storing/retrieving binary files to/from a table - but apparently the size is very small, i.e. ~2Kb as the file is just a one page Xerox metacode file.
The reason I do this because the physical files are archived in daily basis but we still need to have the file quickly on-the-fly for a period of a month - so having the binary in a database is one option. However I believe storing 120Mb of text into a table is bizarre, if I can't say odd :-)
Btw, here is a snippet of the code:
* On inserting
use DBD::Oracle qw(:ora_types);
__PACKAGE__->data_type(cr_data => DBI::SQL_BINARY);
__PACKAGE__->data_type(cr_data => { ora_type => ORA_BLOB,
ora_field => 'column_name' } );
....
* On retrieving:
# Modify DBH LongReadLen for long binary object...
my $dbh = __PACKAGE__->db_Main();
my $current_LongReadLen = $dbh->{LongReadLen};
# need to dynamically set to the length of your record
# it's hardcoded to 512Kb for example...
$dbh->{LongReadLen} = 512 * 1024;
...
Please refer to the Class::DBI wiki as it has a really good explanation on the subject.
Cheers! |