select statement does not run in Toad for SAP but in HANA studio

Hi@all,

this script does not run in Toad for SAP ( HANA ) 3.1.0.315

select
X.COMPETENCE_CENTERS,
X.ESTIMATED_PROJECT_COSTS_KEUR,
X.IMPACT_ON_EBITDA_PER_YEAR_KEUR,
round(case when X.IMPACT_ON_EBITDA_PER_YEAR_KEUR != 0 then X.ESTIMATED_PROJECT_COSTS_KEUR / X.IMPACT_ON_EBITDA_PER_YEAR_KEUR else 0 end,1),
case
when round(case when X.IMPACT_ON_EBITDA_PER_YEAR_KEUR != 0 then X.ESTIMATED_PROJECT_COSTS_KEUR / X.IMPACT_ON_EBITDA_PER_YEAR_KEUR else 0 end,1) between 0.1 and 0.9 then ‘0.5’
when round(case when X.IMPACT_ON_EBITDA_PER_YEAR_KEUR != 0 then X.ESTIMATED_PROJECT_COSTS_KEUR / X.IMPACT_ON_EBITDA_PER_YEAR_KEUR else 0 end,1) between 1.0 and 1.9 then ‘1’
when round(case when X.IMPACT_ON_EBITDA_PER_YEAR_KEUR != 0 then X.ESTIMATED_PROJECT_COSTS_KEUR / X.IMPACT_ON_EBITDA_PER_YEAR_KEUR else 0 end,1) between 2.0 and 2.9 then ‘2’
when round(case when X.IMPACT_ON_EBITDA_PER_YEAR_KEUR != 0 then X.ESTIMATED_PROJECT_COSTS_KEUR / X.IMPACT_ON_EBITDA_PER_YEAR_KEUR else 0 end,1) between 3.0 and 3.9 then ‘3’
when round(case when X.IMPACT_ON_EBITDA_PER_YEAR_KEUR != 0 then X.ESTIMATED_PROJECT_COSTS_KEUR / X.IMPACT_ON_EBITDA_PER_YEAR_KEUR else 0 end,1) between 4.0 and 4.9 then ‘4’
when round(case when X.IMPACT_ON_EBITDA_PER_YEAR_KEUR != 0 then X.ESTIMATED_PROJECT_COSTS_KEUR / X.IMPACT_ON_EBITDA_PER_YEAR_KEUR else 0 end,1) between 5.0 and 5.9 then ‘5’
else ‘9’
end
from TOP_PROJECTS X;

I get only “SAP HANA Database Error:”

but no error number.

In SAP HANA studio 2 it works.

Any idea ?

Hello h.blum,

I can confirm this is a bug. I’ve created TSY-2080 to investigate and fix the problem.

But so far it seems to be a problem in HANA ADO.NET driver. I’ve tested also ODBC connection (HANA ODBC driver 1.0.112.6) and the SQL statement works there.

The division (X.ESTIMATED_PROJECT_COSTS_KEUR / X.IMPACT_ON_EBITDA_PER_YEAR_KEUR) seems to be the problem part of the statement. When I replaced it by some numeric constant it started to work. But I guess this is not the solution you are looking for. :slight_smile:

Libor

Hello,

The problem is really caused by bug in the SAP HANA client. The issue appears if you have more than 6 case statements.

SAP is working on preparing of the fix.

As a workaround you can try to add "as " after the select statement, i.e.:

select
case

end as column_xyz
from …

Libor