Error with SQL code using Uipath

Hi,

I have a function using sql code to get value from Database

And I have error when i copy sql code from Access to Excute Query in uipath

Error status : Execute query: ERROR [42000] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0104 - Token  was not valid. Valid tokens: ( + - ? : DAY INF NAN NOT RID ROW RRN CASE CAST CHAR DATE DAYS.

This is my SQL code:
SELECT OINU5C AS InputDate, OCNU5C AS ConfirmDate, OIDC5C AS Depot, SPRC5C AS SaleManCode, FEMI05 AS SalesManName, CSTC5C AS CustCode, FL1I39 AS CustName,TTRC5C AS Tradeterm, DK1C5C, DK2C5C, DDMF5C, BYRC5C AS BuyerCode, BYRI35 AS BuyerName, CORN5C AS PONo, CTYC5C AS CustType, TTYC5C AS Trade, SMPF5C AS Sample, NCMF5C AS NoCommercial, PPNF5C AS Pricepending, PLTC5E AS Linetype, ORDN5E, EODU5Q AS ETD, ITMC5E AS ItemCode, IT1IA0 AS ItemName, IT2IA0 AS ItemName1, IT3IA0 AS ItemName2, LNGV5E AS Length, LUNC5E AS LenghtUnit, CLRC5E AS Color, SLDCA0 AS Slider, SFNCA0 AS Finish, SL2CA0 AS Slider2, SE2CA0 AS Slider21, SIZCA0 AS Size, CHNCA0 AS Chain, CLSCA0 AS Class, Sum(ORRQ5E) AS QUANTITY, RDLU5C AS RequestDate, NDCU5F AS Ex_Fac, AAFU5F AS FinishDate, DLVU5F AS Delivery, DK1C5C AS DeliveryCode1, DK2C5C AS DeliveryCode2, CN1I09 AS Status, Sum(TCAK5E) AS AmountBeforeTax, TCRC5C AS CURRENCY, PAKU5F AS PackingCompleteDate, AAFQ5F AS FinishQty, PAKQ5F AS PackingQty, CDLF5C AS ComDeli, TRNC5C AS Trans, ORFN5C, PALFA0 AS ProductionFlag FROM WAVEDLIB.S5Q00 INNER JOIN (WAVEDLIB.C0900 INNER JOIN (((WAVEDLIB.S3500 RIGHT JOIN (WAVEDLIB.C0500 INNER JOIN ((WAVEDLIB.S5C00L01 INNER JOIN WAVEDLIB.S3900 ON CSTC5C = CLNC39) INNER JOIN (WAVEDLIB.S5E00 INNER JOIN WAVEDLIB.FA000 ON ITMC5E = ITMCA0) ON ORDN5C = ORDN5E) ON EMPC05 = SPRC5C) ON BYRC35 = BYRC5C) INNER JOIN WAVEDLIB.S5F00 ON (ORDN5E = ORDN5F) AND (OSBN5E = OSBN5F)) INNER JOIN WAVEDLIB.C0900 AS C091 ON PSTC5F = C091.DDTC09) ON DDTC09 = CTYC5C) ON ORDN5Q = ORDN5C GROUP BY OINU5C, OCNU5C, OIDC5C, SPRC5C, FEMI05, CSTC5C, FL1I39, TTRC5C, DDMF5C, BYRC5C, BYRI35, CORN5C, CTYC5C, TTYC5C, SMPF5C, NCMF5C, PPNF5C, PLTC5E, ORDN5E, EODU5Q, ITMC5E, IT1IA0, IT2IA0, IT3IA0, LNGV5E, LUNC5E, CLRC5E, SLDCA0, SFNCA0, SL2CA0, SE2CA0, SIZCA0, CHNCA0, CLSCA0, RDLU5C, NDCU5F, AAFU5F, DLVU5F, DK1C5C, DK2C5C, CN1I09, TCRC5C, PAKU5F, AAFQ5F,PAKQ5F, CDLF5C, TRNC5C, ORFN5C, PALFA0, DK1C5C, DK2C5C, UT1CA0, UT2CA0, UT3CA0, UT4CA0, UT5CA0, UT6CA0, UT7CA0, UT8CA0, UT9CA0, UTACA0, DGRC09, DGRC09 HAVING (((CSTC5C)=’000193’) AND ((DLVU5F)=0) AND ((DGRC09)=’PSTC’) AND ((DGRC09)=’CTYC’))

Please help me to fix problem

Many Thanks!

What happens with a simpler query such as “Select * From WAVEDLIB.S5Q00” ?

The error message makes it seem like your connection is the issue, not your query. Although it could also be a syntax error, it is hard to tell for sure. This is an access database you are querying? If the simpler query works that means it is not a connection issue and you should move onto the syntax. I would start by enclosing all of the column names within [square brackets] and trying again. I’m also not sure why you’re using parenthesis around some of the column names near the bottom of the query such as (CSTC5C) or (DLVU5F) but I would remove them.

Hi @Dave

I tried but when i use name within [square brackets] it will be error like this

Execute query: ERROR [42000] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0104 - Token [ was not valid. Valid tokens: <‘IDENTIFIER’ >.