Skip to Content
0
Jan 15, 2020 at 03:25 PM

Problem SQL query in HANA

244 Views Last edit Jan 15, 2020 at 06:24 PM 2 rev

Hi team,

i'm trying to pass some SQL query to HANA SAP B1 but have some troubles on it.

SET SCHEMA "SBOURBANOR"; SELECT t0.ItemCode, t0.itemname, (select case when t0.itemcode like 'AN1%' then 'ASAI NORTE 1' when t0.itemcode like 'AN2%' then 'ASAI NORTE 2' when t0.itemcode like 'TS5%' then 'TODOS SANTOS 5' when t0.itemcode like 'TS6%' then 'TODOS SANTOS 6' END) as 'Ubicación' , t1.price AS 'Precio de lista contado', substring (t0.itemcode, 5,3) as UV, substring (t0.itemcode, 9,3) as MZA, substring (t0.itemcode, 13,3) as '# Lote/Casa', substring (t0.itemname, 1,4) as Tipo, t0.U_superficie as 'Superficie Mts2' FROM OITM T0 INNER JOIN ITM1 T1 ON T0.[ItemCode] = T1.[ItemCode] INNER JOIN OPLN T2 ON T1.PriceList = T2.ListNum WHERE t0.Iscommited <= 0 and t0.onhand>0 and t0.onorder<=0 and T2.[ListName] = 'CONTADO' AND T1.Price <>0

and get the error: Could not execute 'SELECT t0.ItemCode, t0.itemname, (select case when t0.itemcode like 'AN1%' then 'ASAI NORTE 1' when ...' SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near ")": line 5 col 52 (at pos 252)

can you help finding the problem please? i'm new in HANA.

Thanks