Livi has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I encounter the below mentioned error when I insert data into MySQL table as arrays. The primary key is (c_type,d_pattern). I have checked the arrays and they are properly populated.Please help me out

DBD::mysqlPP::st execute_array failed: #23000Column 'c_type' cannot be nul l err was 1048 now 2000000000 executing 200 generated 100 errors at D:\Project\Tools\my_tool.pl line 463, <BATCH> line 1.

$insert = $dbh->prepare("INSERT INTO $table_name(s_no,c_type,jur,home, +lni,citation,d_pattern,d_text) VALUES(?,?,?,?,?,?,?,?) ON DUPLICATE K +EY UPDATE s_no = s_no,c_type = c_type, jur = jur, home = home, lni = +lni,citation =citation,d_pattern= d_pattern,d_text= d_text") ; my $input_tuples = $insert->execute_ar +ray({ ArrayTupleStatus => \my @tuple_status },\@index_array,\@c_array +,\@jur_array,\@home_array,\@l_array,\@c_array,\@in_array,\@p_array);

Replies are listed 'Best First'.
Re: Help needed
by Old_Gray_Bear (Bishop) on Aug 22, 2011 at 10:53 UTC
    Um --

    DBD::mysqlPP::st execute_array failed: #23000 Column 'c_type' cannot be null err was 1048 now 2000000000 executing 200 generated 100 errors at D:\P +roject\Tools\my_tool.pl line 463, <BATCH> line 1.

    Why is your primary key ('c_type') empty? Trace the bug in your program that caused this and the error will go away.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: Help needed
by Anonymous Monk on Aug 22, 2011 at 10:45 UTC

    I have checked the arrays and they are properly populated.Please help me out

    The error message disagrees with you :) so whatever you checked, you missed one.

    Title: Help needed

    This is textbook ineffective node title, see How do I compose an effective node title?

    An effective title might be DBD::mysqlPP::st execute_array failed: #23000Column 'c_type' cannot be nul

Re: Help needed
by Anonymous Monk on Aug 22, 2011 at 14:53 UTC
    Be sure to check the validity of the data that you are importing! A program should not assume that everything in the incoming data stream is okay; in fact, it probably is not. (An import/export program, unlike most other programs, is considering every single one of the rows. Most programs only look at specific rows-of-interest and may never stumble upon those which contain errors of some kind. Thus, an import/export program is in a very favorable position to act as a data-integrity checker as well as a data mover.)