I am executing the insert query from a shell script which reads data from multiple files. Some of the data to be inserted contains \' in the text a
insert
\'
You need to escape your quote. You can do this by doubling it in your insert query; i.e. use '' rather than '. That is two single quotes rather than a single double quote.