IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ILLEGAL USE OF KEYWORD EXCEPT


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rishi Khare

New User


Joined: 13 Aug 2007
Posts: 16
Location: Mumbai

PostPosted: Tue Oct 14, 2008 5:48 pm
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
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 14, 2008 5:51 pm
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: 8797
Location: Welsh Wales

PostPosted: Tue Oct 14, 2008 5:54 pm
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
Suresh Ponnusamy

Active User


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

PostPosted: Tue Oct 14, 2008 10:35 pm
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts syncsort: copy lines after the keyword SYNCSORT 7
No new posts Illegal use of keyword fetch. Token w... DB2 2
No new posts Illegal symbol syntax error DB2 5
No new posts IFTHEN & BUILD - If keyword match... DFSORT/ICETOOL 4
No new posts COBOL 5.1 and the UNBOUNDED Keyword COBOL Programming 2
Search our Forums:

Back to Top