On 10/10/07, John Scoles <[EMAIL PROTECTED]> wrote:
>
> 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.
[...snip...]
This is the result with the empty strings when using DBD::Oracle :
> main::(db1.pl:47):
>
> my $result = $sth-<dump_results; DB>1 '', '', '', '', '', '' '', '', '',
> '',
> '', '' '', '', '', '', '', '' '', '', '', '', '', '' '', '', '', '', '',
> ''
> 5 rows
>
>
> SQL this is the code i'm using :
> #!/usr/bin/perl use DBI;
#!/usr/bin/perl -w
use strict;
You could waste the one argument you're allowed on -MDBI to load the DBI
module.
use DBD::Oracle;
If it is working at all, I assume the 'use DBI' on the #! line 'works'; you
should be using:
use DBI;
here instead.
$ENV{'LD_LIBRARY_PATH'} =
> '/home/httpd/perl/instantclient_11_1/';
[...11 comments omitted..]
$ENV{NLS_LANG} = 'american_america.we8iso8859p1';
> my $host=
> my $sid=
> my $port=
> my $user =
> my $passwd =
I assume there's a bunch of initializers not shown...
my $dbh = DBI>connect("dbi:Oracle:host=$host;port=$port;sid=$sid", $user,
> $passwd) or die "Unable to connect: $DBI::errstr";
There's a typo above: DBI->connect
my $statement = 'SELECT * FROM table';
> $sth = $dbh->prepare($statement);
There's no evidence here of checking whether the prepare succeeded.
$sth->execute;
There's no evidence here of checking whether the execute succeeded.
my $result = $sth->dump_results;
There's evidence here that some error checking earlier might help.
Put { RaiseError => 1 } as the 4th argument to your DBI->connect.
--
Jonathan Leffler <[EMAIL PROTECTED]> #include <disclaimer.h>
Guardian of DBD::Informix - v2007.0914 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."