0

I am using the below SQL statement to calculate the size of application group data table.

SELECT A.TABLE_NAME FROM ARSSEG A, ARSAG B WHERE A.AGID=B.AGID AND B.NAME='<application group name>' For EACH TABLE_NAME in query 1/, run "SELECT DOC_NAME, MAX(COMP_OFF+COMP_LEN) PLUS FROM <TABLE_NAME> GROUP BY DOC_NAME"

Now when I run this SQL statment in putty it throws an error

bash: syntax error near unexpected token `('

I have cross checket but i could not find where is the error. I need your help please help me out. thank you.

0

Personally I would do this in a compound SQL statement that writes to a table. But if you want to do it from a command line, you could try e.g.

Still, try e.g.

db2 -x "SELECT 'SELECT DOC_NAME, MAX(COMP_OFF+COMP_LEN) PLUS FROM ' || A.TABLE_NAME || '  GROUP BY DOC_NAME ORDER BY A.TABLE_NAME;' FROM ARSSEG A, ARSAG B WHERE A.AGID=B.AGID AND B.NAME='<application group name>'" > tmp.sql
db2 -tf tmp.sql
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.