db2 shell commands

has anyone seen this shell error

0403-057 Syntax error at line 1 : `from' is not expected
su - db2inst1 -c db2 "select ssn from dluip002.tclm_clmnt c , $( select clmnt_id from dluip002.tclm_clm  where  ltst_clm_stat_cd = 1 and ltst_clm_tier_cd = 7 ) as a , $( select clmnt_id from dluip002.tclm_clm where  ltst_clm_stat_cd = 1 and ltst_clm_tier_cd != 7 ) as b where a.clmnt_id = b.clmnt_id and c.clmnt_Id = a.clmnt_id with ur";

Open in new window

ddvigilAsked:
Who is Participating?
 
ddvigilConnect With a Mentor Author Commented:
I think i got it   i need to have a ' in front of the db2

su - db2inst1 -c 'db2 "select

this seems to work


thanks... the dos /unix statement started me to thinking.... my script worked
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi ddviqil,

I'm suspicious of the '$(' pairs in the string.  Drop the '$' and try it again.


Kent
0
 
ddvigilAuthor Commented:
with out the '$' i get this error

>ksh: 0403-057 Syntax error at line 1 : `(' is not expected.


I found a website the said to add the $ to get rid of the above error.  when I put the $ in i get the syntax error on the 'from'
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Kent OlsenConnect With a Mentor Data Warehouse Architect / DBACommented:
Ah.. Ok.  :)

Change the double quotes (") to single quotes (').  That should work fine for this query.

You can also "escape" the '(' characters while using the double quotes.  Depending on the specific unix shell, the escape charater is probably the backslash ('\') instead of the dollar sign ('$').


Kent
0
 
Kent OlsenData Warehouse Architect / DBACommented:
It would appear that you're moving a DOS script to unix.  :)


Kent
0
 
ddvigilAuthor Commented:
what would be the unix script?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.