If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 Query Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-10, 13:28
lgimnvln lgimnvln is offline
Registered User
 
Join Date: Jan 2010
Posts: 1
Lightbulb DB2 Query Help

Hi, I am trying to execute the following query in DB2 command editor,

db2 SELECT B.ACCTNO,B.BNO, B.STATUS, B.ASTATUS, B.VALIDFROM, B.VALIDTO FROM DEB.ACCOUNT B WHERE B.ACCTNO IN (SELECT A.ACCTNO FROM DEB.ACCOUNT A WHERE A.VALIDTO IS NULL AND A.STATUS='0' AND A.ASTATUS='0' GROUP BY A.ACCTNO HAVING COUNT(*) > 1) >> out.txt

and the following error is printed in the out.txt;

SQL0104N An unexpected token "<END-OF-STATEMENT>" was found following "". Expected tokens may include: "< > = <> <= !< !> != ^< ^> ^= >= IN NOT". SQLSTATE=42601

Please help me
Reply With Quote
  #2 (permalink)  
Old 01-18-10, 14:35
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Obviously, single quotation marks and/or asterisk are interpreted by the shell and never make it to the DB2 command line processor. You should enclose the entire SQL statement in double quotation marks.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On