Written by

Developer at Matirx, Israel
Question Nael Nasereldeen · Dec 10, 2017

SQL IN OPERATOR

Hi,

I'm trying to use the IN operator in SQL.

does not work, can anyone tell me why that could be?

for example:

SELECT * FROM TafnitCore_Logistics_TransferPackage_DB.PackageData  WHERE ID IN ('1||1||9852553062' , '1||1||9852553061' ) ORDER BY Building

And I get the following error:

SQL

[SQLCODE: <-400>:<Fatal error occurred>]

  [%msg: <Unexpected error occurred: <UNDEFINED>%0AmBMod+2^%sqlcq.pTAFLIB.cls4.1 *i%%CursorDatad(26)>]

Regards,

Nael

Comments

Vivek Ranjan · Dec 10, 2017

I tried your quey and it ran successfully.

SELECT * FROM Config.IO WHERE ID IN ('1||1||9852553062' , '1||1||9852553061' ) order by 1 desc

The error you got seems very generic. Kindly check the table again.

The SQLCODE -400 error “Fatal error occurred” is a general error. It is generated when a more specific SQLCODE error code is not available. 

0
Nael Nasereldeen  Dec 10, 2017 to Vivek Ranjan

OK Thanks a lot Vivek.

So the syntax is supported, and I have a specific problem with this table.

I will contact WRC.

Regards,

Nael

0
Robert Cemper · Dec 10, 2017

As we see your ID is combined by 3 properties
for the sake of this example I name them id01, id02, id03

so your ID is this combination ID = id01_"||"_id02,_"||"_id03

so you may reformulate your query to make it readable 

SELECT * FROM TafnitCore_Logistics_TransferPackage_DB.PackageData  
WHERE id01=1 AND id02=1 and id03  IN (9852553062, 9852553061 )
ORDER BY Building
0