I'm using db2 export to save data to a CSV file.
Ultimately I need a built a script that will take in a SQL, run it and export it out. I've got almost all of it in place, but certain queries cause errors.
Two cases cause errors at the moment:
1 - Using a wildcard. Shell expansion kills this.
Enclosing the whole SQL in ' seems to fix that, but what is the best practice? There seem to be some edge cases I haven't fixed.
2 - I can't use a string in a where clause:
bash-3.00$ db2 export to /tmp/text of DEL 'select * from SCHEMA.TABLE where COL='STRING''
SQL3022N An SQL error "-206" occurred while processing the SELECT string in
the Action String parameter.
SQL0206N "STRING" is not valid in the context where it is used.
Even changing to a specific column to select and removing the '' from the whole SQL doesn't change it.
Any ideas?
Thanks,
Alex