hello Fellow monks need some help with the code. This code works fine though I am having some trouble with the data thats comings up.
my $dbh = DBI->connect("dbi:CSV:f_dir=$_ENV::TempFilesDIR;csv_sep_char +=\\~") or die $DBI::errstr; $dbh->{'csv_tables'}->{'new_entrant'} = { 'file' => 'Aviva_cimp_new_ +entrant.txt', col_names => [qw(emp_no cat_no forename surname ini +tial ni_no ttl gender mrtl_sts dob hmeadd1 hmeadd2 hmeadd3 h +ometown county homepost emp_cntrbtn emplyr_ctr anl_sal doj_schm + dojcmpny exchanged schm_jnr)]}; $dbh->{'csv_tables'}->{'cimp_monthly'} = { 'file' => 'Aviva_cimp_mont +hly_extract.txt'}; $dbh->{'csv_tables'}->{'rac_monthly'} = { 'file' => 'rac_cimp_monthl +y_extract.txt'}; $dbh->{'csv_tables'}->{'cimp_ops'} = { 'file' => 'Aviva_pension_o +pt_outs_extract.txt'}; $dbh->{'csv_tables'}->{'cimp_leavers'} = { 'file' => 'Aviva_cimp_leav +ers_extract.txt'}; $dbh->{'csv_tables'}->{'rac_leavers'} = { 'file' => 'rac_cimp_leaver +s_extract.txt'}; $dbh->{'csv_tables'}->{'cimp_money'} = { 'file' => 'Aviva_cimp_mone +y_positive.txt'}; $dbh->{'csv_tables'}->{'rac_money'} = { 'file' => 'rac_cimp_money_ +positive.txt'}; $dbh->{'csv_tables'}->{'workday'} = { 'file' => 'workday_mstr_fi +nal.csv'}; my $query = "SELECT Employee_Number,Forename,Surname,Home_Address_Line +_1,Home_Address_Line_2,Home_Address_Line_3,Home_Town_City,Home_County +,Home_Post_Code FROM workday"; my $sth = $dbh->prepare ($query); $sth->execute(); $sth->bind_columns (\my ($wrk_emp_no,$wrk_forename,$wrk_surname,$wrk_h +me_add1,$wrk_hme_add2,$wrk_hme_add3,$wrk_hme_city,$wrk_hme_cnty,$wrk_ +postcode)); while (my $row = $sth->fetch) { $dbh->do("UPDATE new_entrant SET forename='$wrk_forename',surname='$wr +k_surname' FROM new_entrant WHERE emp_no='$wrk_emp_no'") or die $DBI: +:errstr; } $sth->finish(); $dbh->disconnect( );
<Error> Mismatched single quote before: <071444'> at /usr/local/share/perl5/SQL/Statement.pm line 88 Incomplete statement! at /usr/local/share/perl5/SQL/Statement.pm line 88 DBD::CSV::db do failed: Incomplete statement! for Statement "UPDATE new_entrant SET forename='Sebastian',surname='D'Costa' FROM new_entrant WHERE emp_no='071444'" at test.pl line 30. Incomplete statement! at test.pl line 30. </Error>

In reply to Escape characters in DBD CSV by PERL_fresher

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.