Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
ILLEGAL USE OF KEYWORD EXCEPT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
Rishi Khare

New User


Joined: 13 Aug 2007
Posts: 11
Location: Mumbai

PostPosted: Tue Oct 14, 2008 5:48 pm    Post subject: ILLEGAL USE OF KEYWORD EXCEPT
Reply with quote

i need to compare two tables

SELECT COUNT(*) FROM (
(SELECT * FROM t1 AS A
EXCEPT(SELECT * FROM t2) AS B
UNION ALL
(SELECT * FROM t2) AS C
EXCEPT(SELECT * FROM t1) AS D
)


DSNT408I SQLCODE = -199, ERROR: ILLEGAL USE OF KEYWORD EXCEPT. TOKEN FULL
LEFT INNER RIGHT WAS EXPECTED
Back to top
View user's profile Send private message
References
Robert Sample

Senior Member


Joined: 06 Jun 2008
Posts: 1173
Location: Atlanta, GA

PostPosted: Tue Oct 14, 2008 5:51 pm    Post subject:
Reply with quote

Even for a non-DB2 person like me, the message is quite clear -- it wants FULL, LEFT, INNER, or RIGHT and you gave it EXCEPT. Fix the problem and proceed.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 3734
Location: Brussels once more ...

PostPosted: Tue Oct 14, 2008 5:54 pm    Post subject:
Reply with quote

And for another non DB2 person like me - it is pretty clear that this should have been perhaps posted in the DB2 forum !!!
Back to top
View user's profile Send private message
Moved: Tue Oct 14, 2008 5:55 pm by expat From CLIST & REXX to DB2
Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 104
Location: New York

PostPosted: Tue Oct 14, 2008 10:35 pm    Post subject:
Reply with quote

Hi Rishi

Your synax is wrong. Probably try the below one.
SELECT COUNT(*)
FROM
(
(
(SELECT * FROM t1 A)
EXCEPT
(SELECT * FROM t2 B)
) E
UNION ALL
(
(SELECT * FROM t2 C)
EXCEPT
(SELECT * FROM t1 D)
) F
) G;;


Please note that I have not tested the above query since I am not having DB2 9 in my system. EXCEPT is DB2 9 function.

Suggestions are welcome.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1