Search code examples
linuxshelldb2shpid

how can I use '$$' as column data in a db2 update query when running in script


I have to run an update query in shell script

db2 "update tablename set fam=' ' where fam='$$' ";

Even though the table has fam='$$' I'am getting the below message as:

No row found for FETCH,UPDATE or DELETE; or the result of a query is an empty table.

this is because "$$" is considered as PID ie process id. So how can I handle this


Solution

  • Try something like this:

    db2 "update tablename set fam=' ' where fam='\$\$' ";
    

    You need to escape special characters.