Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hi. Sorry if this turns out to be a newbie mistake, but I've run into an odd problem while using DBD::Oracle. For some reason, my sql statement results in empty strings. Instead of getting the value i want to see there is a "''," (please see below). The amount of columns (6 in this case) are correct. I'm using perl v5.8.8, DBD::Oracle v1.19, Oracle instantclient-basic - instantclient-devel and sqlplus. Does someone know what i'm doing wrong? How do i get the values correctly like in sqlplus?

When i manually do a query with help of sqlplus of the Oracle instant client it is ok (see below).

This is the result with the empty strings when using DBD::Oracle :

main::( my $result = $sth->dump_results;

'', '', '', '', '', ''
'', '', '', '', '', ''
'', '', '', '', '', ''
'', '', '', '', '', ''
'', '', '', '', '', ''
5 rows

This is the result when using sqlplus :

node1# ./sqlplus login/login@//ip:port/db

SQL*Plus: Release - Production on Wed Oct 10 10:36:34 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Compatible Release
Oracle Rdb OCI Server Release - Production, Level 1.7
Oracle Rdb SQL Release - Production
SQL> select * from table;
table1 ta table3 t table5 table 6
------ -- ------ - ------ -------------
004400 10 075935 0 075935 1
004400 10 075938 0 075938 1
520020 71 127464 0 127464 1
004400 10 075939 0 075939 1
004400 10 075945 0 075945 1
5 rows selected.

This is the code i'm using :

#!/usr/bin/perl use DBI; use DBD::Oracle; $ENV{'LD_LIBRARY_PATH'} = '/home/httpd/perl/instantclient_11_1/'; #$ENV{'NLS_LANG'} = 'AMERICAN_AMERICA.UTF8'; #$ENV{'NLS_LANG'} = 'AMERICAN_AMERICA.AL32UTF8'; #$$ENV{'NLS_NCHAR'} = 'AL32UTF8'; #$ENV{'NLS_NCHAR'} = 'UTF8'; #$ENV{NLS_LANG}="AMERICAN_AMERICA.WE8MACROMAN8S"; #$ENV{'NLS_LANG'} = 'WE8ISO8859P1'; #$ENV{'NLS_LANG'} = 'WE8MSWIN1252'; #$ENV{'NLS_LANG'} = 'US7ASCII'; #$ENV{'NLS_LANG'} = 'UTF8'; #$ENV{'NLS_LANG'} = 'AL32UTF32'; $ENV{NLS_LANG} = 'american_america.we8iso8859p1'; my $host= my $sid= my $port= my $user = my $passwd = my $dbh = DBI>connect("dbi:Oracle:host=$host;port=$port;sid=$sid", +$user, $passwd) or die "Unable to connect: $DBI::errstr"; my $statement = 'SELECT * FROM table'; $sth = $dbh->prepare($statement); $sth->execute; my $result = $sth->dump_results;

Thank you in advance,


In reply to DBD::ORACLE - empty strings in result while there supposed to be values by Ricardo

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (7)
    As of 2018-06-19 16:09 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (114 votes). Check out past polls.