Oracle CLOB using DBI

Discussion in 'Perl Misc' started by Ken Chesak, Jun 24, 2003.

  1. Ken Chesak

    Ken Chesak Guest

    Does someone have a working code sample of Perl/DBI returning a CLOB
    column from Oracle. Here is what I came up with, I counld not get
    ORA_CLOB to work.

    $sth1 = $dbh->prepare(q{
    BEGIN OPEN :cursor FOR
    SELECT dbms_lob.substr( comments, 30000, 1)
    FROM comments WHERE id_comment = 46;
    END;
    });

    $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
    => ORA_RS
    ET } );
    $sth1->execute();

    while ( @row = $sth2->fetchrow ) {
    print "row = @row\n";
    }

    Thanks
     
    Ken Chesak, Jun 24, 2003
    #1
    1. Advertising

  2. Ken Chesak

    Ron Reidy Guest

    What error (if any) are you getting? Did you 'perldoc DBD::Oracle' and
    look at the section entitled 'Handling LOBS'? Did you set
    LongReadLen/LongTruncOK on the $dbh?

    --
    Ron Reidy
    Oracle DBA

    Ken Chesak wrote:
    > Does someone have a working code sample of Perl/DBI returning a CLOB
    > column from Oracle. Here is what I came up with, I counld not get
    > ORA_CLOB to work.
    >
    > $sth1 = $dbh->prepare(q{
    > BEGIN OPEN :cursor FOR
    > SELECT dbms_lob.substr( comments, 30000, 1)
    > FROM comments WHERE id_comment = 46;
    > END;
    > });
    >
    > $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
    > => ORA_RS
    > ET } );
    > $sth1->execute();
    >
    > while ( @row = $sth2->fetchrow ) {
    > print "row = @row\n";
    > }
    >
    > Thanks



    --
    Ron Reidy
    Oracle DBA
     
    Ron Reidy, Jun 25, 2003
    #2
    1. Advertising

  3. On 24 Jun 2003 13:55:40 -0700, (Ken Chesak)
    wrote:

    >Does someone have a working code sample of Perl/DBI returning a CLOB
    >column from Oracle. Here is what I came up with, I counld not get
    >ORA_CLOB to work.
    >
    >$sth1 = $dbh->prepare(q{
    > BEGIN OPEN :cursor FOR
    > SELECT dbms_lob.substr( comments, 30000, 1)
    > FROM comments WHERE id_comment = 46;
    > END;
    > });
    >
    > $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
    >=> ORA_RS
    >ET } );
    > $sth1->execute();
    >
    > while ( @row = $sth2->fetchrow ) {
    > print "row = @row\n";
    > }
    >
    >Thanks
     
    Markus Stueker, Jun 25, 2003
    #3
  4. Ken Chesak

    Ron Reidy Guest

    From metalink Note 19792.1:

    Error: ORA 3115

    Text: unsupported network datatype or representation

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

    Cause: A user bind or define, or an Oracle function, is not supported by
    this

    heterogeneous SQL*Net connection.

    Action: Upgrade the older version of Oracle and try again.

    Do you have an old Oracle install on the machine the code is running on?
    If so, this is your problem.

    --
    Ron Reidy
    Oracle DBA

    Ken Chesak wrote:
    > Would you email my hotmail account again, I delete by mistake since
    > 99% is junk mail.
    >
    > I get the following error,
    >
    > DBD::Oracle::db prepare failed: ORA-03115: unsupported network
    > datatype or repre
    > sentation (DBD: odescr failed) at clob.pl line 26.
    >
    > It runs if I use dbms_lob.substr( comments, 30000, 1).
    >
    > $dbh->{LongReadLen} = 512 * 1024 ;
    > $dbh->{LongTruncOk} = 1;
    >
    > $sth1 = $dbh->prepare(q{
    > SELECT cd_type, comments
    > FROM comments WHERE id_comment = 53
    > });
    >
    > $sth1->execute();
    >
    > while ( ($name, $data) = $sth1->fetchrow_array ) {
    >
    > print "row = $name $data \n";
    >
    > }



    --
    Ron Reidy
    Oracle DBA
     
    Ron Reidy, Jun 26, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ulloa
    Replies:
    1
    Views:
    531
    Juha Laiho
    Jul 22, 2004
  2. =?Utf-8?B?RGlmZmlkZW50?=

    Oracle CLOB column

    =?Utf-8?B?RGlmZmlkZW50?=, Jun 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,370
    =?Utf-8?B?RGlmZmlkZW50?=
    Jun 7, 2005
  3. Replies:
    0
    Views:
    2,470
  4. Replies:
    1
    Views:
    1,464
    RedGrittyBrick
    Sep 21, 2007
  5. Vincent Le-Texier
    Replies:
    1
    Views:
    156
    Paul Lalli
    Dec 3, 2004
Loading...

Share This Page