I have a situation where I'm looping through to generate a SQL statement to update a table. Wha'ts happening though is The site name has an apostrophe in the value and the perl script throws an error at that point.
Here is the piece of code that generates the SQLSQL = UPDATE LIR_BUT_SITE SET ROW_IDENTIFIER = '4' , M_CUSTOMER_ABBREV = 'IBHW' , M_SITE_KEY = 'R_LIR_BUT_SITE-' , RESP_CENTER = 'Global Custom Svcs GCSC' , M_SITE_NAME = 'MZ3481-CHILDREN'S HOSPITAL WALTHAM'
for $idx (0..$#hdr) { if ($row[$idx] ne "") { if ($found ne "N") { $updstmt .= ", "; $insstmt .= ", "; $valstmt .= ", "; } $found = "Y"; $updstmt .= $hdr[$idx]." = '".$row[$idx]."' \ +r\n";
The values for the update are generated by the $row$idx.How do I put that $row$idx within double quotes or how do i make the perl interpreter escape any apostrophes in that field. Can some one suggest a solution?
Thanks.In reply to Escaping Apostrophe by perl_gvenk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |