I have a requirement to extract data from Netezza DB into a text file. In this process I need to add additional \
before \ or "
that exists in data. when I try to use the below mentioned sql query in it is working.
select guest_key, cast(replace_nvarchar(replace_nvarchar(guest_last_nm,'\','\\'),'"','\"') as nchar(100)) as guest_last_nm from admin.cdr_mrdw_dim_messaging_ota limit 100;
but when I use the same query in shell script it says function does not exists.
nzsql -d $NZ_DATABASE -F $'\t' -A -c "select guest_key, cast(replace_nvarchar(replace_nvarchar(guest_last_nm,'\','\\'),'"','\"') as nchar(100)) as guest_last_nm from admin.cdr_mrdw_dim_messaging_ota limit 100;" > cdr_mrdw_dim_messaging_ota.txt
Error: Function 'replace(varchar, unknown)' does not exist. Unable to identify a function that satisfies the given argument types. You may need to add explicit typecasts```
tried translate function too. Same error has been shown. What is this error and how to resolve this??
Thanks.