?
Solved

db2 shell commands

Posted on 2009-02-13
6
Medium Priority
?
512 Views
Last Modified: 2012-08-13
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

0
Comment
Question by:ddvigil
  • 3
  • 3
6 Comments
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 23633990
Hi ddviqil,

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


Kent
0
 

Author Comment

by:ddvigil
ID: 23634964
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
 
LVL 46

Assisted Solution

by:Kent Olsen
Kent Olsen earned 80 total points
ID: 23635024
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
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 
LVL 46

Expert Comment

by:Kent Olsen
ID: 23635029
It would appear that you're moving a DOS script to unix.  :)


Kent
0
 

Author Comment

by:ddvigil
ID: 23635498
what would be the unix script?
0
 

Accepted Solution

by:
ddvigil earned 0 total points
ID: 23635564
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
MS outlook is a premier email client that enable you to send and receive the e-mails with various file formats of attachments such as document files, media file, and many others formats. There is some scenario occurs when a receiver of an e-mail mes…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question