The following SQL request work, but l am not able to put the CHAR "," between more then one FK_COLNAMES. the output look like that:
FOREIGN KEY (x,,,,,y) and I need FOREIGN KEY(x,y). Who can help me
db2 +o -x +v +c -r/$DB2TMP/db2refint.bk "SELECT 'ALTER TABLE ' \
||RTRIM(SUBSTR(tabschema,1,10))|| '.' ||RTRIM(SUBSTR(TABNAME,1,50)), \
'ADD CONSTRAINT ' || RTRIM(CONSTNAME),'FOREIGN KEY \
(' ||REPLACE(RTRIM(LTRIM(substr(FK_COLNAMES,1,100))), ' ',',')|| ')', \
'REFERENCES ' ||RTRIM(SUBSTR(tabschema,1,10)) || \
'.' ||RTRIM(SUBSTR(REFTABNAME,1,17)) \
,' ON DELETE ' || case deleterule \
when 'A' then 'NO ACTION' \
when 'C' then 'CASCADE' \
when 'N' then 'SET NULL' \
when 'R' then 'RESTRICT' \
end, \
' ON UPDATE ' || case updaterule \
when 'A' then 'NO ACTION' \
when 'R' then 'RESTRICT' \
end \
|| ';' \
FROM \
SYSCAT.REFERENCES \
where \
tabschema like '${schema}%'"