Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Question

Status
Not open for further replies.

ansonee

Programmer
Apr 22, 2004
3
0
0
US
I'm new to Tek-Tips so woukld like to first say hi....hi.

Onto business ;-)

I have an IF statement that to me looks like it should be fine, but for some reason get an error. Here's the statement:

IF (SELECT ArchiveType FROM AIM.ArchiveType WHERE ArchiveID = decArchiveID) = 'O' AND

(SELECT
AIM.CHANNEL.CHANNEL
FROM
AIM.AIMCONNECTION,
AIM.ARCHIVERETRIEVAL,
AIM.AIMRETRIEVAL,
AIM.CHANNELSESSION,
AIM.CHANNEL,
AIM.AIMQUERY
WHERE
AIM.CHANNEL.CHANNELID = AIM.CHANNELSESSION.CHANNELID
AND AIM.CHANNELSESSION.CHANNELSESSIONID = AIM.AIMCONNECTION.CHANNELSESSIONID
AND AIM.AIMCONNECTION.AIMCONNECTIONID = AIM.AIMQUERY.AIMCONNECTIONID
AND AIM.AIMQUERY.AIMQUERYID = AIM.AIMRETRIEVAL.AIMQUERYID
AND AIM.AIMRETRIEVAL.AIMRETRIEVALID = AIM.ARCHIVERETRIEVAL.AIMRETRIEVALID
AND AIM.CHANNELSESSION.CHANNEL) IN ('INTRANET', 'CIB')
THEN
SET dateExpirationDate = (AIM.NEXT_BUS_DATE (DATE(CURRENT TIMESTAMP),5));

Here's the error:

AIM.CreateArchiveRetrieval: 39: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token ")" was found following "ANNELSESSION.CHANNEL". Expected tokens may include: "<comp_op> <quantifier> <subquery>". LINE NUMBER=39. SQLSTATE=42601

AIM.CreateArchiveRetrieval - Build failed.

I'm sure I'm missing something easy. Any help would be really appreciated.

Thanks!
 
The right parenthesis before IN ('INTRANET', 'CIB') matches the opening parenthesis before your second SELECT. Which is pretty much what it says in your error message...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top