SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Error message "Use of uninitialized value in concatenation (.) or string at...

    The error message reads "Use of uninitialized value in concatenation (.) or string at test_connect.pl line 23"
    What is strange is this code was previously working with no problems, but now seems to be producing the above message:

    #!/usr/bin/perl -w
    use DBI;
    use strict;

    my $dbh = DBI->connect( 'dbi:Oracle:database_name',
    'username',
    'password',
    {
    RaiseError => 1,
    AutoCommit => 0
    }
    ) || die "Database connection not made: $DBI::errstr";

    my$sql = qq{ SELECT * FROM customers};
    my $sth = $dbh->prepare( $sql );
    $sth->execute();
    my( $customerid, $companyname, $contactname, $address, $phone);
    $sth->bind_columns( undef, \$customerid, \$companyname, \$contactname, \$address, \$phone);

    while( $sth->fetch() ) {
    print "CustID: $customerid, company name: $companyname, contact name: $contactname\n";
    }

    $sth->finish();
    $dbh->disconnect();

    Any help would be appreciated
    Thanks

  2. #2
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    these have no values:

    my( $customerid, $companyname, $contactname, $address, $phone);

    then you use them in the next line:

    $sth->bind_columns( undef, \$customerid, \$companyname, \$contactname, \$address, \$phone);

    then use use them again:

    while( $sth->fetch() ) {
    print "CustID: $customerid, company name: $companyname, contact name: $contactname\n";
    }

    thats why you see the warnings (not errors).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •