develooper Front page | perl.dbi.users | Postings from February 2001

long datatype retrieval from oracle 7.3

Thread Next
From:
Janice
Date:
February 26, 2001 06:15
Subject:
long datatype retrieval from oracle 7.3
Message ID:
3A9A67DA.37280FE8@nationalgeographic.com
Hi,

I'm new to this list, but was wondering if somebody could help me...
I am trying to retrieve one row with a bunch of fields from my oracle
7.3 table, one of which includes a long datatype.

My code looks roughly like this:

-----------------------------------------------------------------

# Prepare select statement to get product from db
 $stmt = "SELECT long_description FROM PRODUCT WHERE PRODUCT_ID  =
$prod_id";

 $dbh->{LongReadLen} = 1024 * 1024;   # Set up longest long data
expected...this is just a guess here
 $dbh->{LongTruncOk} = 1;                   # Do not truncate if it is
too short... give error instead

 $sth = $dbh->prepare($stmt)  or die "Couldn't prepare statement: " .
$dbh->errstr;
 $sth->execute() or die "Couldn't execute statement: " . $sth->errstr;

@row_results = $sth->fetchrow_array();
 $prod_form_mid .= "<h3>Long_Desc: $row_results[0]</h3>";
-------------------------------------------------------------------

When I print this out, what I get is the 1st character only of my
long_description field.

Two notes here:
1) I don't think my longest long is anywhere near 1024x1024...i was just
trying to get *any* data.
2) If I set LongTruncOk to 0 (which is the functionality i really want),
i get a truncation error.
    When it is set to 1, I get the first character only.

Anybody have any thoughts?  What am I doing wrong?

Thanks in advance for any help here.....
Janice






Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About