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

RE: long datatype retrieval from oracle 7.3

Thread Previous
From:
Sterin, Ilya
Date:
February 26, 2001 09:21
Subject:
RE: long datatype retrieval from oracle 7.3
Message ID:
E989263E0496D3119C440008C791853401B45FCD@cibermail2.ciber.com
Can't set LongReadLen to more than 65535 since DBD::Oracle was compiled
using OCI 7.  You must use blob_read or readblob to fetch in chunks.  Set
the Readme.longs in the DBD::Oracle package for examples.

Ilya Sterin

-----Original Message-----
From: Janice
To: dbi-users@perl.org
Sent: 02/26/2001 7:27 AM
Subject: long datatype retrieval from oracle 7.3

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 Previous


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