Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8286317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:42:17+00:00 2026-06-08T11:42:17+00:00

I have the following procedure, which I’m using to synchronize two MySQL tables: sub

  • 0

I have the following procedure, which I’m using to synchronize two MySQL tables:

sub sync{
    my %tables = (
        'sitematrix_test' => 'sitematrix_sites'
    );

    while(($key, $value) = each(%tables)){
        print "Matching columns $key : $value\n";

        my @data;
        my $query = $db->prepare("
            SELECT $key.* FROM $key LEFT JOIN $value ON 
            $key.site_id = $value.site_id WHERE $value.site_id IS NULL;
        ") 
            or die "Couldn't prepare statement: " . $db->errstr;

        $query->execute() 
            or die "Couldn't execute statement: " . $query->errstr;

        if($query->rows == 0){
            print "No updates have been made for $key : $value";
        }
        else{
            #read the matching records and print them out
            while(@data = $query->fetchrow_array()){
                print "@data\n";
            }
        }

        $query->finish;
    }

    $db->disconnect;    
}

It’s giving the following error:

Use of uninitialized value $data[3] in join or string at C:/Users/souzamor/workspace/Parser/synchronizer.pl line 69.
Use of uninitialized value $data[4] in join or string at C:/Users/souzamor/workspace/Parser/synchronizer.pl line 69.
Use of uninitialized value $data[5] in join or string at C:/Users/souzamor/workspace/Parser/synchronizer.pl line 69.
Use of uninitialized value $data[6] in join or string at C:/Users/souzamor/workspace/Parser/synchronizer.pl line 69.

Could someone please explain why is it going beyond the array’s bound?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:42:20+00:00Added an answer on June 8, 2026 at 11:42 am

    You have NULLs in your data coming from the database; these get converted to undef in Perl. The warning is coming from this line:

    print "@data\n";
    

    where you stringify the array. Example:

    perl -Mwarnings -e '@foo=(1, 2, undef, 3); print "@foo\n"'
    Use of uninitialized value $foo[2] in join or string at -e line 1.
    1 2  3
    

    If you really want to stringify the whole array and print it each time, a simple fix would be to convert undefs to empty strings:

    while( my @data = map { defined($_) ? $_ : '' } $query->fetchrow_array() ) {
    

    Alternatively, if you don’t need to print all the data for every row, just print a primary key or something that you know will not be NULL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql stored procedure which is giving me the following error:- #1064
I am using mysql 5.0. I have a stored procedure which gets all the
I have the following stored procedure which will generate mon to sun and then
I have a stored procedure in which if I write the following query without
I am using Oracle 10g and I have the following stored procedure: CREATE OR
I have following procedure which is filling up null values in a column. The
I am using oracle 11g and have written a stored procedure which stores values
Actually i have created following procedure,which is working fine. CREATE or REPLACE PROCEDURE GET_NOS(
I have the following stored procedure, which returns 0 results but if the run
i have in a procedure which fills a table the following sql SELECT NVL(SUM(COL1),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.