<[EMAIL PROTECTED]> wrote:
> 
> could someone tell me what "use of uninitialized in concatenation<.> or string"
> means.  It hasn't effected the running of the process, or its results, but
> still, I'd like to know what its talking about.  Here's the sub:
> 
> sub sqlInsert {
> my $k=0;
> my $table='event;
> my $fields='CR,CR_IND_DESCR,TYPE';
> 
> my $sqlIn=qq{ INSERT INTO $table
> ($fields)
> VALUES(?,?,?)};
> my $sth=$dbhSQL->prepare($sqlIn);
> 
> foreach my $key(sort(@cash)){
> my @[EMAIL PROTECTED];
> $sth->execute($row[0],$row[1],$row[2]);
> print LOG "$row[0],$row[1],$row[2] added\n";
> $k=$k+1;
> }
> print "$k rows added to $table\n";
> $sth->finish;
> 
> }
> 
> The warning says its referring to the print LOG line.

You have warnings enabled, and one or more of $row[0], $row[1] or $row[2] are
undefined at this point. 'An undef' value in an SQL INSERT statement usually
results in a NULL value in the database column. Try this instead:

  printf LOG "%s, %s, %s added\n", map defined $_ ? $_ : 'NULL', @row[0..2];

which will print 'NULL' for any undefined values, and avoid the warning.

HTH,

Rob

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to