I've been programming Perl for quite a while, but I've just recently
started to 'use strict' because, well it seems like the right thing to
do.
 
However, I'm getting this runtime error: "Use of uninitialized value in
join or string at test56.pl line 40." Line 40 is the one where the same
message is in the comment.
 
I realize that the sample code has some elements specific to my
environment, but it is the best I could do, and it is pared down quite a
bit.
 
Thanks,
Barry Brevik
---------------------------------- 
use strict;
use warnings;
use Win32::ODBC;
use Win32::Console;

# Un-buffer STDOUT.
select((select(STDOUT), $| = 1)[0]);

# Set up a DSN-less connection.
my $connectStr = "DRIVER=Microsoft ODBC for Oracle; SERVER=prod;
UID=APPS; PWD=apps";

my $SQLsentence = <<SQL;
select
  fa.asset_number
, fa.asset_description
, fa.manufacturer_name
, fa.serial_number
, fa.owned_leased
, fa.new_used
, fa.category_description

from
  fafg_assets fa

order by
  fa.category_description, fa.asset_description
SQL

getOutFile();

if (my $db = new Win32::ODBC($connectStr))
{
  # Execute our SQL sentence.
  unless ($db -> Sql($SQLsentence))
  {
    # Loop through the table.
    while (scalar $db -> FetchRow(1, SQL_FETCH_NEXT))
    {
      my @data = $db -> Data();
      
      print OUTFILE '"', (join '","', @data), '"', "\n";
    }
  }

  $db -> Close();
}

#------------------------------------------------
sub getOutFile
{
  my $filename = "c:\\temp\\asset.csv";

  if (open OUTFILE, '>', $filename)
  {
    print "  Output file $filename has been CREATED.\n\n";
  }
}

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to