Hello Fellow monks need some help here. Below code works fine however I am facing other issues which are quite difficult to explain. basically whats happening is say my forename = Nitin then its correctly updating as Nitin, however if forename in workday file has 'Nitin Rane' my final output file has "Nitin Rane". I dont want " quotes in my final target final. is there any way to do it in existing code? otherwise I can simply loop these files and remove " but it may impact data as well if its valid " it shouldnt be removed? I am not sure where its adding " to the file may be DBI connect is taking csv_quote_char as " by default?
use DBI; require '_ENV.pl'; 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 initial ni_no ttl gender mrtl_sts + dob hmeadd1 hmeadd2 hmeadd3 hometown county homepost emp_cntr +btn emplyr_ctr anl_sal doj_schm dojcmpny exchanged schm_jnr) ] }; $dbh->{'csv_tables'}->{'workday'} = { 'file' => 'workday_mst +r_final.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=?,surname=?,hmeadd1=?,hmeadd +2=?,hmeadd3=?,hometown=?,county=?,homepost=? WHERE emp_no=?',undef,$w +rk_forename,$wrk_surname,$wrk_hme_add1,$wrk_hme_add2,$wrk_hme_add3,$w +rk_hme_city,$wrk_hme_cnty,$wrk_postcode,$wrk_emp_no) or die $DBI::err +str; } $sth->finish(); $dbh->disconnect();

In reply to CSV Update Issues 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.