MCMULLIN, NANCY wrote on 26.05.2004:
>Does anyone know why this script hangs when it's executed? It's
>probably due to the complex select statement, but I'm not sure how
>to make it work.
>
>Also, is there a good 'DBI with SQL with Perl' book out there?
>
John already recommended O'Reilly's 'Programming the Perl DBI'.
>================
>#!c:/activeperl/bin/perl
>use strict;
>use warnings;
>use DBI;
>use CGI qw(:standard escapeHTML);
>print ("Content-type: text/html\n\n");
>use vars qw($dbh);
>my $dbh = DBI->connect('DBI:Oracle:db', 'user', 'pw');
You're missing a server name here:
my $dbh = DBI->connect("DBI:Oracle:$db:$server", $username, $password, { RaiseError
=> 1 });
But since you're on Windows, I am not sure if this is your problem. Try 'localhost' as
the server name if the Oracle DB is running on your machine.
>my $Command = "select cl.c_oac_oban, cd.c_fund_code,
> cd.d_doc_nbr,
> cd.ie_dollar_amt,
> cd.d_cost_cd,
> cd.d_coc
> from cpas_difms cd, cpas_load cl
> where cd.ie_proc_cd='1'
> and cl.ie_infile = cd.ie_infile
> and cl.ie_seq_nbr = cd.ie_seq_nbr
> union all
> select gl.g_oac || gl.g_asn_oban oac_oban, gd.g_fund_code,
> gd.d_doc_nbr,
> gd.ie_dollar_amt,
> gd.d_cost_cd,
> gd.d_coc
> from gafs_difms gd, gafs_load gl
> where gd.ie_proc_cd='1'
> and gl.ie_infile = gd.ie_infile
> and gl.ie_seq_nbr = gd.ie_seq_nbr";
>my $sth = $dbh->prepare($Command);
>my $rc = $sth->execute;
You do not need to assign the result of $sth->execute unless you want to use it
somewhere.
>while (my @row = $sth->fetchrow_array)
> {print "<br> $row[0] $row[1] $row[2] $row[3] $row[4] $row[5]\n";}
>$sth->finish;
>exit(0);
HTH.
Jan
--
These are my principles and if you don't like them... well, I have others. - Groucho
Marx
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>