Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scalars

Status
Not open for further replies.
Joined
Jun 19, 2001
Messages
86
Location
US
Is there a maximum size for scalars in perl. Is there a buffer size I can set? I am having trouble when I do a sql select with the Oracle DBI if the string is too long.
 
nationavon,

This is straight from my Perl book:

The longest string fills all of your available memory (although you wouldn't be able to do much with that). This is in accordance with the principle of "no built-in limits" that Perl follows at every opportunity.

Brandon
 
From reading that it sounds like my problem lies with the DBI Oracle module.
 
How long is the string you're trying to read? If it's longer than 200 or so, you may need to set an option to tell the interface you need longer strings. I don't know about Oracle, but in MySQL if you want to read a string (or glob) longer than 200 you need this statement:
Code:
$dbh->{'LongReadLen'} = 1024;

Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
"Programming the Perl DBI" by Descartes and Bunce has a section towards the back that describes each of the databases - the Oracle section describes

String data handling

VARCHAR2(size) - limit 2000 bytes for Oracle 7, and 4000 bytes for Oracle 8
CHAR - limit 2000 bytes
RAW - limit 2000 bytes

LONG/BLOB data handling

LONG - can hold up to 2 GB
LOB - can hold up to 4 GB
FILE - can hold up to 4 GB

The book on p. 141-142 says
"LongReadLen typically defaults to 0 or a small value
like 80, which means that little or no LONG data will
be fetched at all. If you plan to fetch any LONG
datatypes, you should set LongReadLen within your
application to slightly more then the length of the
longest column you expect to fetch. Setting it too
high just wastes memory."

Read the perldocs for DBI on LongReadLen - on *nix, do

perldoc DBI

and search(using the slash "/") for "LongReadLen" - there's a lot of great info in there to help you.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top